├── docs ├── source │ ├── images │ │ ├── ctmrg_top_left.pdf │ │ ├── ctmrg_top_right.pdf │ │ ├── kagome_structure.pdf │ │ ├── square_lattice.pdf │ │ ├── ctmrg_bottom_left.pdf │ │ ├── ctmrg_bottom_right.pdf │ │ ├── CTMRG_Absorption_D_C3.pdf │ │ ├── CTMRG_Absorption_D_C4.pdf │ │ ├── CTMRG_Absorption_D_T3.pdf │ │ ├── CTMRG_Absorption_L_C1.pdf │ │ ├── CTMRG_Absorption_L_C4.pdf │ │ ├── CTMRG_Absorption_L_T4.pdf │ │ ├── CTMRG_Absorption_R_C2.pdf │ │ ├── CTMRG_Absorption_R_C3.pdf │ │ ├── CTMRG_Absorption_R_T2.pdf │ │ ├── CTMRG_Absorption_U_C1.pdf │ │ ├── CTMRG_Absorption_U_C2.pdf │ │ ├── CTMRG_Absorption_U_T1.pdf │ │ ├── honeycomb_structure.pdf │ │ ├── maple_leaf_structure.pdf │ │ ├── triangular_structure.pdf │ │ ├── ctmrg_top_left_large_d.pdf │ │ ├── ctmrg_top_right_large_d.pdf │ │ ├── square_kagome_structure.pdf │ │ ├── ctmrg_bottom_left_large_d.pdf │ │ ├── ctmrg_bottom_right_large_d.pdf │ │ ├── floret_pentagon_structure.pdf │ │ ├── floret_pentagon_bond_colors.pdf │ │ ├── Makefile │ │ ├── square_lattice.tex │ │ ├── ctmrg_bottom_left.tex │ │ ├── ctmrg_bottom_right.tex │ │ ├── CTMRG_Absorption_L_C4.tex │ │ ├── CTMRG_Absorption_R_C3.tex │ │ ├── CTMRG_Absorption_U_C2.tex │ │ ├── ctmrg_bottom_left_large_d.tex │ │ ├── ctmrg_bottom_right_large_d.tex │ │ ├── CTMRG_Absorption_D_C3.tex │ │ ├── CTMRG_Absorption_D_C4.tex │ │ ├── CTMRG_Absorption_L_C1.tex │ │ ├── CTMRG_Absorption_U_C1.tex │ │ ├── ctmrg_top_left.tex │ │ ├── ctmrg_top_left_large_d.tex │ │ ├── ctmrg_top_right.tex │ │ ├── CTMRG_Absorption_R_C2.tex │ │ ├── ctmrg_top_right_large_d.tex │ │ ├── CTMRG_Absorption_L_T4.tex │ │ ├── CTMRG_Absorption_R_T2.tex │ │ ├── CTMRG_Absorption_D_T3.tex │ │ ├── CTMRG_Absorption_U_T1.tex │ │ ├── triangular_structure.tex │ │ ├── kagome_structure.tex │ │ ├── square_kagome_structure.tex │ │ ├── maple_leaf_structure.tex │ │ ├── floret_pentagon_bond_colors.tex │ │ ├── honeycomb_structure.tex │ │ └── floret_pentagon_structure.tex │ ├── api │ │ ├── config.rst │ │ ├── contractions │ │ │ ├── apply.rst │ │ │ ├── definitions.rst │ │ │ └── index.rst │ │ ├── utils │ │ │ ├── svd.rst │ │ │ ├── debug_print.rst │ │ │ ├── random.rst │ │ │ ├── projector_dict.rst │ │ │ ├── periodic_indices.rst │ │ │ └── index.rst │ │ ├── peps │ │ │ ├── index.rst │ │ │ ├── tensor.rst │ │ │ └── unitcell.rst │ │ ├── typing.rst │ │ ├── expectation │ │ │ ├── model.rst │ │ │ ├── one_site.rst │ │ │ ├── two_sites.rst │ │ │ ├── four_sites.rst │ │ │ ├── three_sites.rst │ │ │ ├── spiral_helpers.rst │ │ │ └── index.rst │ │ ├── mapping │ │ │ ├── kagome.rst │ │ │ ├── honeycomb.rst │ │ │ ├── maple_leaf.rst │ │ │ ├── triangular.rst │ │ │ ├── square_kagome.rst │ │ │ ├── florett_pentagon.rst │ │ │ └── index.rst │ │ ├── ctmrg │ │ │ ├── index.rst │ │ │ ├── projectors.rst │ │ │ ├── absorption.rst │ │ │ └── routine.rst │ │ ├── index.rst │ │ └── optimization │ │ │ ├── optimizer.rst │ │ │ ├── basinhopping.rst │ │ │ ├── line_search.rst │ │ │ ├── inner_function.rst │ │ │ └── index.rst │ ├── index.rst │ ├── design │ │ └── features.rst │ ├── general.rst │ └── conf.py ├── requirements.txt ├── Makefile └── make.bat ├── varipeps ├── contractions │ ├── __init__.py │ └── apply.py ├── overlap │ ├── __init__.py │ ├── overlap_single_site.py │ ├── overlap.py │ └── overlap_four_sites.py ├── utils │ ├── __init__.py │ ├── extensions │ │ └── svd_ffi.h │ ├── func_cache.py │ ├── debug_print.py │ ├── periodic_indices.py │ └── projector_dict.py ├── corrlength │ ├── __init__.py │ ├── corrlength.py │ └── triangular_corrlength.py ├── mapping │ ├── __init__.py │ └── model.py ├── peps │ └── __init__.py ├── optimization │ ├── __init__.py │ └── basinhopping.py ├── ctmrg │ └── __init__.py ├── expectation │ ├── __init__.py │ ├── triangular_one_site.py │ ├── model.py │ ├── spiral_helpers.py │ ├── four_sites.py │ └── structure_factor.py ├── __version__.py ├── __init__.py ├── typing.py └── global_state.py ├── .readthedocs.yml ├── .dir-locals.el ├── CITATION.cff ├── pyproject.toml ├── CMakeLists.txt ├── .github └── workflows │ └── release.yml ├── .zenodo.json ├── examples └── heisenberg_afm_square.py └── README.md /docs/source/images/ctmrg_top_left.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_top_left.pdf -------------------------------------------------------------------------------- /docs/source/images/ctmrg_top_right.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_top_right.pdf -------------------------------------------------------------------------------- /docs/source/images/kagome_structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/kagome_structure.pdf -------------------------------------------------------------------------------- /docs/source/images/square_lattice.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/square_lattice.pdf -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_left.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_bottom_left.pdf -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_right.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_bottom_right.pdf -------------------------------------------------------------------------------- /varipeps/contractions/__init__.py: -------------------------------------------------------------------------------- 1 | from .apply import apply_contraction, apply_contraction_jitted 2 | from .definitions import Definitions 3 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx>=4.4.0 2 | sphinx_rtd_theme>=1.0.0 3 | sphinx_autodoc_defaultargs>=0.1.2 4 | sphinx_subfigure>=0.2.4 5 | 6 | -e . 7 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_D_C3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_D_C3.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_D_C4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_D_C4.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_D_T3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_D_T3.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_L_C1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_L_C1.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_L_C4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_L_C4.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_L_T4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_L_T4.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_R_C2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_R_C2.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_R_C3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_R_C3.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_R_T2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_R_T2.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_U_C1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_U_C1.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_U_C2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_U_C2.pdf -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_U_T1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/CTMRG_Absorption_U_T1.pdf -------------------------------------------------------------------------------- /docs/source/images/honeycomb_structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/honeycomb_structure.pdf -------------------------------------------------------------------------------- /docs/source/images/maple_leaf_structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/maple_leaf_structure.pdf -------------------------------------------------------------------------------- /docs/source/images/triangular_structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/triangular_structure.pdf -------------------------------------------------------------------------------- /docs/source/images/ctmrg_top_left_large_d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_top_left_large_d.pdf -------------------------------------------------------------------------------- /docs/source/images/ctmrg_top_right_large_d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_top_right_large_d.pdf -------------------------------------------------------------------------------- /docs/source/images/square_kagome_structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/square_kagome_structure.pdf -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_left_large_d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_bottom_left_large_d.pdf -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_right_large_d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/ctmrg_bottom_right_large_d.pdf -------------------------------------------------------------------------------- /docs/source/images/floret_pentagon_structure.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/floret_pentagon_structure.pdf -------------------------------------------------------------------------------- /docs/source/images/floret_pentagon_bond_colors.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/variPEPS/variPEPS_Python/HEAD/docs/source/images/floret_pentagon_bond_colors.pdf -------------------------------------------------------------------------------- /varipeps/overlap/__init__.py: -------------------------------------------------------------------------------- 1 | from . import overlap 2 | from . import overlap_single_site 3 | from . import overlap_four_sites 4 | 5 | from .overlap import calculate_overlap 6 | -------------------------------------------------------------------------------- /varipeps/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import debug_print 2 | from . import func_cache 3 | from . import random 4 | from . import projector_dict 5 | from . import slurm 6 | from . import svd 7 | -------------------------------------------------------------------------------- /varipeps/corrlength/__init__.py: -------------------------------------------------------------------------------- 1 | from . import corrlength 2 | from . import triangular_corrlength 3 | from .corrlength import calculate_correlation_length 4 | from .triangular_corrlength import calculate_triangular_correlation_length 5 | -------------------------------------------------------------------------------- /varipeps/mapping/__init__.py: -------------------------------------------------------------------------------- 1 | from .model import Map_To_PEPS_Model 2 | from . import florett_pentagon 3 | from . import honeycomb 4 | from . import kagome 5 | from . import maple_leaf 6 | from . import square_kagome 7 | from . import triangular 8 | -------------------------------------------------------------------------------- /varipeps/peps/__init__.py: -------------------------------------------------------------------------------- 1 | from . import tensor 2 | from . import unitcell 3 | from .tensor import ( 4 | PEPS_Tensor, 5 | PEPS_Tensor_Structure_Factor, 6 | PEPS_Tensor_Split_Transfer, 7 | PEPS_Tensor_Triangular, 8 | ) 9 | from .unitcell import PEPS_Unit_Cell 10 | -------------------------------------------------------------------------------- /docs/source/api/config.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_config: 2 | 3 | .. currentmodule:: varipeps.config 4 | 5 | Config of variPEPS module (:mod:`varipeps.config`) 6 | ================================================== 7 | 8 | .. automodule:: varipeps.config 9 | :members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /docs/source/api/contractions/apply.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_contractions_apply: 2 | 3 | .. currentmodule:: varipeps.contractions 4 | 5 | Apply a contraction (:func:`varipeps.contractions.apply_contraction`) 6 | ===================================================================== 7 | 8 | .. autofunction:: apply_contraction 9 | -------------------------------------------------------------------------------- /docs/source/api/utils/svd.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_utils_svd: 2 | 3 | .. currentmodule:: varipeps.utils.svd 4 | 5 | SVD helpers (:mod:`varipeps.utils.svd`) 6 | ======================================= 7 | 8 | .. automodule:: varipeps.utils.svd 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | Variational PEPS 2 | ================ 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: VariPEPS 7 | 8 | general 9 | design/features 10 | examples 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :caption: API documentation 15 | 16 | Public API Reference 17 | -------------------------------------------------------------------------------- /docs/source/api/peps/index.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_peps: 2 | 3 | .. py:module:: varipeps.peps 4 | 5 | .. currentmodule:: varipeps.peps 6 | 7 | Implementation of PEPS structure (:mod:`varipeps.peps`) 8 | ======================================================= 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | tensor 14 | unitcell 15 | -------------------------------------------------------------------------------- /docs/source/api/typing.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_typing: 2 | 3 | .. py:module:: varipeps.typing 4 | 5 | .. currentmodule:: varipeps.typing 6 | 7 | Typing helper (:mod:`varipeps.typing`) 8 | ====================================== 9 | 10 | .. automodule:: varipeps.typing 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | :noindex: 15 | -------------------------------------------------------------------------------- /docs/source/api/peps/tensor.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_peps_tensor: 2 | 3 | .. currentmodule:: varipeps.peps 4 | 5 | Single PEPS tensor (:class:`varipeps.peps.PEPS_Tensor`) 6 | ======================================================= 7 | 8 | .. autoclass:: PEPS_Tensor 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __add__ 13 | -------------------------------------------------------------------------------- /docs/source/api/peps/unitcell.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_peps_unit_cell: 2 | 3 | .. currentmodule:: varipeps.peps 4 | 5 | PEPS Unit cell (:class:`varipeps.peps.PEPS_Unit_Cell`) 6 | ====================================================== 7 | 8 | .. autoclass:: PEPS_Unit_Cell 9 | :members: 10 | :undoc-members: 11 | :special-members: __getitem__ 12 | :show-inheritance: 13 | -------------------------------------------------------------------------------- /docs/source/api/utils/debug_print.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_utils_debug_print: 2 | 3 | .. currentmodule:: varipeps.utils.debug_print 4 | 5 | Debugging output helpers (:mod:`varipeps.utils.debug_print`) 6 | ============================================================ 7 | 8 | .. automodule:: varipeps.utils.debug_print 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /docs/source/api/expectation/model.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_expectation_model: 2 | 3 | .. currentmodule:: varipeps.expectation.model 4 | 5 | Model of general expectation value calculation 6 | ============================================== 7 | 8 | .. automodule:: varipeps.expectation.model 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/expectation/one_site.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_expectation_one_site: 2 | 3 | .. currentmodule:: varipeps.expectation.one_site 4 | 5 | Calculation of one site expectation values 6 | ========================================== 7 | 8 | .. automodule:: varipeps.expectation.one_site 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/contractions/definitions.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_contractions_definitions: 2 | 3 | .. currentmodule:: varipeps.contractions 4 | 5 | Definitions for contractions (:class:`varipeps.contractions.Definitions`) 6 | ========================================================================= 7 | 8 | .. autoclass:: Definitions 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /docs/source/api/expectation/two_sites.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_expectation_two_sites: 2 | 3 | .. currentmodule:: varipeps.expectation.two_sites 4 | 5 | Calculation of two sites expectation values 6 | =========================================== 7 | 8 | .. automodule:: varipeps.expectation.two_sites 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/expectation/four_sites.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_expectation_four_sites: 2 | 3 | .. currentmodule:: varipeps.expectation.four_sites 4 | 5 | Calculation of four sites expectation values 6 | ============================================ 7 | 8 | .. automodule:: varipeps.expectation.four_sites 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/mapping/kagome.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_mapping_kagome: 2 | 3 | .. currentmodule:: varipeps.mapping.kagome 4 | 5 | Mapping of Kagome structures (:mod:`varipeps.mapping.kagome`) 6 | ============================================================= 7 | 8 | .. automodule:: varipeps.mapping.kagome 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/expectation/three_sites.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_expectation_three_sites: 2 | 3 | .. currentmodule:: varipeps.expectation.three_sites 4 | 5 | Calculation of three sites expectation values 6 | ============================================= 7 | 8 | .. automodule:: varipeps.expectation.three_sites 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/utils/random.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_utils_random: 2 | 3 | .. py:module:: varipeps.utils.random 4 | 5 | .. currentmodule:: varipeps.utils.random 6 | 7 | Random number helpers (:mod:`varipeps.utils.random`) 8 | ==================================================== 9 | 10 | .. automodule:: varipeps.utils.random 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | :noindex: 15 | -------------------------------------------------------------------------------- /docs/source/api/expectation/spiral_helpers.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_expectation_spiral_helpers: 2 | 3 | .. currentmodule:: varipeps.expectation.spiral_helpers 4 | 5 | Helper functions for spiral iPEPS ansatz 6 | ======================================== 7 | 8 | .. automodule:: varipeps.expectation.spiral_helpers 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/utils/projector_dict.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_utils_projector_dict: 2 | 3 | .. currentmodule:: varipeps.utils.projector_dict 4 | 5 | CTM projector management helpers (:mod:`varipeps.utils.projector_dict`) 6 | ======================================================================= 7 | 8 | .. automodule:: varipeps.utils.projector_dict 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /docs/source/api/mapping/honeycomb.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_mapping_honeycomb: 2 | 3 | .. currentmodule:: varipeps.mapping.honeycomb 4 | 5 | Mapping of Honeycomb structures (:mod:`varipeps.mapping.honeycomb`) 6 | =================================================================== 7 | 8 | .. automodule:: varipeps.mapping.honeycomb 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/utils/periodic_indices.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_utils_periodic_indices: 2 | 3 | .. currentmodule:: varipeps.utils.periodic_indices 4 | 5 | Helper to calculate perodic indices (:mod:`varipeps.utils.periodic_indices`) 6 | ============================================================================ 7 | 8 | .. automodule:: varipeps.utils.periodic_indices 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /docs/source/api/mapping/maple_leaf.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_mapping_maple_leaf: 2 | 3 | .. currentmodule:: varipeps.mapping.maple_leaf 4 | 5 | Mapping of Maple leaf structures (:mod:`varipeps.mapping.maple_leaf`) 6 | ===================================================================== 7 | 8 | .. automodule:: varipeps.mapping.maple_leaf 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/mapping/triangular.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_mapping_triangular: 2 | 3 | .. currentmodule:: varipeps.mapping.triangular 4 | 5 | Mapping of Triangular structures (:mod:`varipeps.mapping.triangular`) 6 | ===================================================================== 7 | 8 | .. automodule:: varipeps.mapping.triangular 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/ctmrg/index.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_ctmrg: 2 | 3 | .. py:module:: varipeps.ctmrg 4 | 5 | .. currentmodule:: varipeps.ctmrg 6 | 7 | CTMRG method (:mod:`varipeps.ctmrg`) 8 | ==================================== 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | absorption 14 | projectors 15 | routine 16 | 17 | .. automodule:: varipeps.ctmrg 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | :noindex: 22 | -------------------------------------------------------------------------------- /docs/source/api/ctmrg/projectors.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_ctmrg_projectors: 2 | 3 | .. module:: varipeps.ctmrg.projectors 4 | 5 | .. currentmodule:: varipeps.ctmrg.projectors 6 | 7 | Calculation of CTMRG projectors (:mod:`varipeps.ctmrg.projectors`) 8 | ================================================================== 9 | 10 | .. automodule:: varipeps.ctmrg.projectors 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | :noindex: 15 | -------------------------------------------------------------------------------- /docs/source/design/features.rst: -------------------------------------------------------------------------------- 1 | .. _design_features: 2 | 3 | 4 | Features 5 | ======== 6 | 7 | The implementation of variational PEPS supports the following features: 8 | 9 | #. Target non-bipartite lattices, example the Honeycomb and the Kagome 10 | lattice. 11 | 12 | #. General unit cell (atleast) for the square lattice 13 | 14 | #. Support complex tensors, gpu, etc 15 | 16 | #. Different optimizers such as Gradient descent, L-BFGS, etc 17 | -------------------------------------------------------------------------------- /docs/source/api/mapping/square_kagome.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_mapping_square_kagome: 2 | 3 | .. currentmodule:: varipeps.mapping.square_kagome 4 | 5 | Mapping of Square-Kagome structures (:mod:`varipeps.mapping.square_kagome`) 6 | =========================================================================== 7 | 8 | .. automodule:: varipeps.mapping.square_kagome 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/ctmrg/absorption.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_ctmrg_absorption: 2 | 3 | .. module:: varipeps.ctmrg.absorption 4 | 5 | .. currentmodule:: varipeps.ctmrg.absorption 6 | 7 | Calculate the new CTMRG tensors for a single step (:mod:`varipeps.ctmrg.absorption`) 8 | ==================================================================================== 9 | 10 | .. automodule:: varipeps.ctmrg.absorption 11 | :members: 12 | :show-inheritance: 13 | :noindex: 14 | -------------------------------------------------------------------------------- /docs/source/api/index.rst: -------------------------------------------------------------------------------- 1 | .. _api: 2 | 3 | .. module:: varipeps 4 | 5 | ###################### 6 | variPEPS API reference 7 | ###################### 8 | 9 | This reference documents the public API of the :mod:`varipeps` module. 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | config 15 | contractions/index 16 | ctmrg/index 17 | expectation/index 18 | mapping/index 19 | optimization/index 20 | peps/index 21 | typing 22 | utils/index 23 | -------------------------------------------------------------------------------- /docs/source/api/mapping/florett_pentagon.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_mapping_florett_pentagon: 2 | 3 | .. currentmodule:: varipeps.mapping.florett_pentagon 4 | 5 | Mapping of Floret-Pentagon structures (:mod:`varipeps.mapping.florett_pentagon`) 6 | ================================================================================ 7 | 8 | .. automodule:: varipeps.mapping.florett_pentagon 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | :special-members: __call__ 13 | -------------------------------------------------------------------------------- /docs/source/api/ctmrg/routine.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_ctmrg_routine: 2 | 3 | .. currentmodule:: varipeps.ctmrg 4 | 5 | Calculate the new converged CTMRG tensors (:func:`varipeps.ctmrg.calc_ctmrg_env` and :func:`varipeps.ctmrg.calc_ctmrg_env_custom_rule`) 6 | ======================================================================================================================================= 7 | 8 | .. autofunction:: calc_ctmrg_env 9 | 10 | .. autofunction:: calc_ctmrg_env_custom_rule 11 | -------------------------------------------------------------------------------- /docs/source/api/optimization/optimizer.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_optimization_optimizer: 2 | 3 | .. currentmodule:: varipeps.optimization.optimizer 4 | 5 | Implementation of the variational optimizer for the PEPS model (:mod:`varipeps.optimization.optimizer`) 6 | ======================================================================================================= 7 | 8 | .. automodule:: varipeps.optimization.optimizer 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /varipeps/optimization/__init__.py: -------------------------------------------------------------------------------- 1 | from . import inner_function 2 | from . import line_search 3 | from . import optimizer 4 | from . import basinhopping 5 | 6 | from .optimizer import ( 7 | optimize_peps_network, 8 | optimize_peps_unitcell, 9 | optimize_unitcell_fixed_spiral_vector, 10 | optimize_unitcell_full_spiral_vector, 11 | optimize_unitcell_spiral_vector_x_component, 12 | optimize_unitcell_spiral_vector_y_component, 13 | restart_from_state_file, 14 | ) 15 | -------------------------------------------------------------------------------- /docs/source/images/Makefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | SRCS := $(wildcard *.tex) 4 | PDFS := $(SRCS:%.tex=%.pdf) 5 | SVGS := $(SRCS:%.tex=%.svg) 6 | 7 | AUXS := $(SRCS:%.tex=%.aux) 8 | TEXLOGS := $(SRCS:%.tex=%.log) 9 | 10 | all: ${PDFS} ${SVGS} 11 | 12 | %.pdf: %.tex 13 | pdflatex "$<" 14 | 15 | %.svg: %.pdf 16 | inkscape --pdf-poppler "$<" -o "$@" 17 | 18 | texauxclean: 19 | rm -f ${AUXS} 20 | rm -f ${TEXLOGS} 21 | 22 | clean: texauxclean 23 | rm -f ${PDFS} 24 | rm -f ${SVGS} 25 | -------------------------------------------------------------------------------- /docs/source/api/utils/index.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_utils: 2 | 3 | .. py:module:: varipeps.utils 4 | 5 | .. currentmodule:: varipeps.utils 6 | 7 | Utility functions (:mod:`varipeps.utils`) 8 | ========================================= 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | debug_print 14 | periodic_indices 15 | projector_dict 16 | random 17 | svd 18 | 19 | .. automodule:: varipeps.utils 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | :noindex: 24 | -------------------------------------------------------------------------------- /docs/source/api/optimization/basinhopping.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_optimization_basinhopping: 2 | 3 | .. currentmodule:: varipeps.optimization.basinhopping 4 | 5 | Implementation of the basinhopping optimizer for the PEPS model (:mod:`varipeps.optimization.basinhopping`) 6 | =========================================================================================================== 7 | 8 | .. automodule:: varipeps.optimization.basinhopping 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /docs/source/api/optimization/line_search.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_optimization_line_search: 2 | 3 | .. currentmodule:: varipeps.optimization.line_search 4 | 5 | Implementation of line search methods for the CTMRG variational optimization (:mod:`varipeps.optimization.line_search`) 6 | ======================================================================================================================= 7 | 8 | .. automodule:: varipeps.optimization.line_search 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /varipeps/ctmrg/__init__.py: -------------------------------------------------------------------------------- 1 | from . import absorption 2 | from . import projectors 3 | from . import routine 4 | from . import structure_factor_absorption 5 | from . import structure_factor_routine 6 | from . import triangular_absorption 7 | from . import triangular_projectors 8 | 9 | from .routine import ( 10 | calc_ctmrg_env, 11 | calc_ctmrg_env_custom_rule, 12 | CTMRGNotConvergedError, 13 | CTMRGGradientNotConvergedError, 14 | ) 15 | 16 | from .structure_factor_routine import calc_ctmrg_env_structure_factor 17 | -------------------------------------------------------------------------------- /docs/source/api/contractions/index.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_contractions: 2 | 3 | .. py:module:: varipeps.contractions 4 | 5 | .. currentmodule:: varipeps.contractions 6 | 7 | Contractions definitions and helper methods (:mod:`varipeps.contractions`) 8 | ========================================================================== 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | definitions 14 | apply 15 | 16 | .. automodule:: varipeps.contractions 17 | :members: 18 | :undoc-members: 19 | :show-inheritance: 20 | :noindex: 21 | -------------------------------------------------------------------------------- /docs/source/api/optimization/inner_function.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_optimization_inner_function: 2 | 3 | .. currentmodule:: varipeps.optimization.inner_function 4 | 5 | Methods to calculate the CTRMG env and expectation value along with the gradient (:mod:`varipeps.optimization.inner_function`) 6 | ============================================================================================================================== 7 | 8 | .. automodule:: varipeps.optimization.inner_function 9 | :members: 10 | :undoc-members: 11 | :show-inheritance: 12 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | # Set the version of Python and other tools you might need 4 | build: 5 | os: ubuntu-lts-latest 6 | tools: 7 | python: latest 8 | 9 | # Build documentation in the docs/ directory with Sphinx 10 | sphinx: 11 | configuration: docs/source/conf.py 12 | 13 | # If using Sphinx, optionally build your docs in additional formats such as PDF 14 | formats: all 15 | 16 | # Optionally declare the Python requirements required to build your docs 17 | python: 18 | install: 19 | - requirements: docs/requirements.txt 20 | -------------------------------------------------------------------------------- /varipeps/expectation/__init__.py: -------------------------------------------------------------------------------- 1 | from . import helpers 2 | from . import spiral_helpers 3 | from . import structure_factor 4 | from . import model 5 | from . import one_site 6 | from . import two_sites 7 | from . import three_sites 8 | from . import four_sites 9 | from . import triangular_helpers 10 | from . import triangular_one_site 11 | from . import triangular_two_sites 12 | from . import triangular_next_nearest 13 | 14 | from .model import Expectation_Model 15 | from .one_site import One_Site_Expectation_Value 16 | from .two_sites import Two_Sites_Expectation_Value 17 | -------------------------------------------------------------------------------- /docs/source/api/expectation/index.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_expectation: 2 | 3 | .. py:module:: varipeps.expectation 4 | 5 | .. currentmodule:: varipeps.expectation 6 | 7 | Calculation of expectation values (:mod:`varipeps.expectation`) 8 | =============================================================== 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | model 14 | one_site 15 | two_sites 16 | three_sites 17 | four_sites 18 | spiral_helpers 19 | 20 | .. automodule:: varipeps.expectation 21 | :members: 22 | :undoc-members: 23 | :show-inheritance: 24 | :noindex: 25 | -------------------------------------------------------------------------------- /docs/source/api/optimization/index.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_optimization: 2 | 3 | .. py:module:: varipeps.optimization 4 | 5 | .. currentmodule:: varipeps.optimization 6 | 7 | Variational optimizer for the PEPS network (:mod:`varipeps.optimization`) 8 | ========================================================================= 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | basinhopping 14 | inner_function 15 | line_search 16 | optimizer 17 | 18 | .. automodule:: varipeps.optimization 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | :noindex: 23 | -------------------------------------------------------------------------------- /docs/source/api/mapping/index.rst: -------------------------------------------------------------------------------- 1 | .. _varipeps_mapping: 2 | 3 | .. py:module:: varipeps.mapping 4 | 5 | .. currentmodule:: varipeps.mapping 6 | 7 | Mapping of other structures to PEPS unitcells (:mod:`varipeps.mapping`) 8 | ======================================================================= 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | florett_pentagon 14 | honeycomb 15 | kagome 16 | maple_leaf 17 | square_kagome 18 | triangular 19 | 20 | .. automodule:: varipeps.mapping 21 | :members: 22 | :undoc-members: 23 | :show-inheritance: 24 | :noindex: 25 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /varipeps/utils/extensions/svd_ffi.h: -------------------------------------------------------------------------------- 1 | #ifndef VARIPEPS_SVD_FFI_H_ 2 | #define VARIPEPS_SVD_FFI_H_ 3 | 4 | #include "xla/ffi/api/ffi.h" 5 | 6 | enum class UVtMode : int8_t { 7 | computeOnlyU = 0, // Compute only U 8 | computeOnlyVt = 1, // Compute only Vt 9 | computePartialUandVt = 2, // Compute only Vt 10 | }; 11 | 12 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_f32); 13 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_f64); 14 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_c64); 15 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_c128); 16 | 17 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_qr_f32); 18 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_qr_f64); 19 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_qr_c64); 20 | XLA_FFI_DECLARE_HANDLER_SYMBOL(svd_only_u_vt_qr_c128); 21 | 22 | #endif // VARIPEPS_SVD_FFI_H 23 | -------------------------------------------------------------------------------- /varipeps/utils/func_cache.py: -------------------------------------------------------------------------------- 1 | import collections 2 | from dataclasses import dataclass, field 3 | 4 | import jax 5 | 6 | from typing import Any, Dict 7 | 8 | 9 | @dataclass 10 | class Checkpointing_Cache(collections.abc.MutableMapping): 11 | enable_checkpointing: bool 12 | cache: Dict[str, Any] = field(default_factory=dict) 13 | 14 | def __getitem__(self, key: str) -> Any: 15 | return self.cache[key] 16 | 17 | def __setitem__(self, key: str, value: Any) -> None: 18 | if self.enable_checkpointing: 19 | self.cache[key] = jax.checkpoint(value) 20 | else: 21 | self.cache[key] = value 22 | 23 | def __delitem__(self, key: str) -> None: 24 | self.cache.__delitem__(key) 25 | 26 | def __iter__(self): 27 | return self.cache.__iter__() 28 | 29 | def __len__(self): 30 | return self.cache.__len__() 31 | -------------------------------------------------------------------------------- /varipeps/__version__.py: -------------------------------------------------------------------------------- 1 | import importlib.metadata 2 | import pathlib 3 | import subprocess 4 | 5 | __version__ = importlib.metadata.version("varipeps") 6 | 7 | try: 8 | git_commit = ( 9 | subprocess.check_output( 10 | ["git", "rev-parse", "HEAD"], 11 | cwd=pathlib.Path(__file__).parent, 12 | stderr=subprocess.DEVNULL, 13 | ) 14 | .decode("ascii") 15 | .strip() 16 | ) 17 | except subprocess.CalledProcessError: 18 | git_commit = None 19 | 20 | try: 21 | git_tag = ( 22 | subprocess.check_output( 23 | ["git", "describe", "--exact-match", "--tags", "HEAD"], 24 | cwd=pathlib.Path(__file__).parent, 25 | stderr=subprocess.DEVNULL, 26 | ) 27 | .decode("ascii") 28 | .strip() 29 | ) 30 | except subprocess.CalledProcessError: 31 | git_tag = None 32 | -------------------------------------------------------------------------------- /varipeps/__init__.py: -------------------------------------------------------------------------------- 1 | # First import config so it is usable in other parts of the module 2 | from .config import wrapper as config 3 | from .config import config as varipeps_config 4 | from .global_state import global_state as varipeps_global_state 5 | 6 | from . import contractions 7 | from . import corrlength 8 | from . import ctmrg 9 | from . import expectation 10 | from . import mapping 11 | from . import optimization 12 | from . import overlap 13 | from . import peps 14 | from . import typing 15 | from . import utils 16 | 17 | from .__version__ import __version__, git_commit, git_tag 18 | 19 | from jax import config as jax_config 20 | 21 | jax_config.update("jax_enable_x64", True) 22 | 23 | from tqdm_loggable.tqdm_logging import tqdm_logging 24 | import datetime 25 | 26 | tqdm_logging.set_log_rate(datetime.timedelta(seconds=60)) 27 | 28 | del datetime 29 | del tqdm_logging 30 | del jax_config 31 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.https://www.sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/source/images/square_lattice.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | \definecolor{googleR}{HTML}{DB4437} 11 | \definecolor{googleG}{HTML}{0F9D58} 12 | \definecolor{googleB}{HTML}{4285F4} 13 | 14 | % main document 15 | \begin{document} 16 | \begin{tikzpicture}[] 17 | \foreach \y in {-0.75, -0.25, +0.25} { 18 | \foreach \x in {-1.5, -0.5, +0.5, +1.5} { 19 | \begin{scope}[shift = {(2*\x + 2*\y, 2*\y)}] 20 | \draw[thick, googleR] (-1.00, 0) to (-0.00, 0); 21 | \draw[thick, googleR] (+0.00, 0) to (+1.00, 0); 22 | \draw[thick, googleB] (-0.50, -0.50) to (0, 0); 23 | \draw[thick, googleB] (0, 0) to (+0.50, +0.50); 24 | \draw[thick] (0, 0) to (0, -0.50); 25 | \draw[thick, fill = googleG] (0,0) circle (0.15); 26 | % \draw[thick, googleG] (-0.15, 0) to (+0.15, 0); 27 | \end{scope} 28 | } 29 | } 30 | \end{tikzpicture} 31 | \end{document} 32 | 33 | %%% Local Variables: 34 | %%% mode: latex 35 | %%% TeX-master: t 36 | %%% End: 37 | -------------------------------------------------------------------------------- /varipeps/typing.py: -------------------------------------------------------------------------------- 1 | """ 2 | Typing helper for the module 3 | """ 4 | 5 | from __future__ import annotations 6 | 7 | from typing import Union, Any 8 | 9 | import numpy as np 10 | import jax 11 | import jax.numpy as jnp 12 | 13 | Tensor = Union[ 14 | np.ndarray, jax.numpy.ndarray 15 | ] #: Typing object for a numpy or jax tensor 16 | 17 | 18 | def is_tensor(a: Any) -> bool: 19 | """ 20 | Test if object is a numpy or jax tensor 21 | 22 | Args: 23 | a: Object to be tested 24 | Returns: 25 | bool: 26 | True if object is a numpy or jax.ndarray. False otherwise. 27 | """ 28 | return isinstance(a, (np.ndarray, jnp.ndarray)) 29 | 30 | 31 | def is_int(a: Any) -> bool: 32 | """ 33 | Test if object is a integer. 34 | 35 | Args: 36 | a: Object to be tested 37 | Returns: 38 | bool: 39 | True if object is a integer. False otherwise. 40 | """ 41 | if isinstance(a, int): 42 | return True 43 | 44 | if ( 45 | isinstance(a, np.ndarray) 46 | and np.isscalar(a) 47 | and np.issubdtype(a.dtype, np.integer) 48 | ): 49 | return True 50 | 51 | if ( 52 | isinstance(a, jnp.ndarray) 53 | and a.ndim == 0 54 | and jnp.issubdtype(a.dtype, jnp.integer) 55 | ): 56 | return True 57 | 58 | return False 59 | -------------------------------------------------------------------------------- /varipeps/overlap/overlap_single_site.py: -------------------------------------------------------------------------------- 1 | import jax.numpy as jnp 2 | 3 | from jax import jit 4 | 5 | from varipeps.contractions import apply_contraction_jitted 6 | 7 | 8 | class Overlap_Single_Site: 9 | @staticmethod 10 | @jit 11 | def calc_overlap(unitcell): 12 | density_matrix = apply_contraction_jitted( 13 | "density_matrix_one_site", 14 | [unitcell[0, 0][0][0].tensor], 15 | [unitcell[0, 0][0][0]], 16 | [], 17 | ) 18 | 19 | norm_with_site = jnp.trace(density_matrix) 20 | 21 | norm_corners = apply_contraction_jitted( 22 | "overlap_one_site_only_corners", 23 | [unitcell[0, 0][0][0].tensor], 24 | [unitcell[0, 0][0][0]], 25 | [], 26 | ) 27 | 28 | norm_horizontal = apply_contraction_jitted( 29 | "overlap_one_site_only_transfer_horizontal", 30 | [unitcell[0, 0][0][0].tensor], 31 | [unitcell[0, 0][0][0]], 32 | [], 33 | ) 34 | 35 | norm_vertical = apply_contraction_jitted( 36 | "overlap_one_site_only_transfer_vertical", 37 | [unitcell[0, 0][0][0].tensor], 38 | [unitcell[0, 0][0][0]], 39 | [], 40 | ) 41 | 42 | return (norm_with_site * norm_corners) / (norm_horizontal * norm_vertical) 43 | -------------------------------------------------------------------------------- /varipeps/global_state.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | from jax.tree_util import register_pytree_node_class 4 | 5 | from typing import TypeVar, Tuple, Any, Type, Optional 6 | 7 | from .config import Projector_Method 8 | 9 | T_VariPEPS_Global_State = TypeVar( 10 | "T_VariPEPS_Global_State", bound="VariPEPS_Global_State" 11 | ) 12 | 13 | 14 | @dataclass 15 | @register_pytree_node_class 16 | class VariPEPS_Global_State: 17 | """ 18 | Class to track internal global state. Values of the instance of this 19 | class should not be modified by users. 20 | """ 21 | 22 | ctmrg_effective_truncation_eps: Optional[float] = None 23 | ctmrg_projector_method: Optional[Projector_Method] = None 24 | basinhopping_disable_half_projector: Optional[bool] = None 25 | 26 | def tree_flatten(self) -> Tuple[Tuple[Any, ...], Tuple[Any, ...]]: 27 | aux_data = ( 28 | {name: getattr(self, name) for name in self.__dataclass_fields__.keys()}, 29 | ) 30 | 31 | return ((), aux_data) 32 | 33 | @classmethod 34 | def tree_unflatten( 35 | cls: Type[T_VariPEPS_Global_State], 36 | aux_data: Tuple[Any, ...], 37 | children: Tuple[Any, ...], 38 | ) -> T_VariPEPS_Global_State: 39 | (data_dict,) = aux_data 40 | 41 | return cls(**data_dict) 42 | 43 | 44 | global_state = VariPEPS_Global_State() 45 | -------------------------------------------------------------------------------- /varipeps/expectation/triangular_one_site.py: -------------------------------------------------------------------------------- 1 | from functools import partial 2 | 3 | import jax 4 | import jax.numpy as jnp 5 | from jax import jit 6 | 7 | from varipeps.contractions import apply_contraction_jitted 8 | 9 | 10 | @partial(jit, static_argnums=(3,)) 11 | def _one_site_workhorse( 12 | peps_tensors, 13 | peps_tensor_objs, 14 | gates, 15 | real_result=False, 16 | ): 17 | density_matrix = apply_contraction_jitted( 18 | "triangular_ctmrg_one_site_expectation", 19 | [peps_tensors[0]], 20 | [peps_tensor_objs[0]], 21 | [], 22 | ) 23 | 24 | norm = jnp.trace(density_matrix) 25 | 26 | if real_result: 27 | return [ 28 | jnp.real(jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm) 29 | for g in gates 30 | ] 31 | else: 32 | return [ 33 | jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm for g in gates 34 | ] 35 | 36 | 37 | def calc_triangular_one_site( 38 | peps_tensors, 39 | peps_tensor_objs, 40 | gates, 41 | ): 42 | if isinstance(peps_tensors, jnp.ndarray): 43 | peps_tensors = (peps_tensors,) 44 | peps_tensor_objs = (peps_tensor_objs,) 45 | 46 | real_result = all(jnp.allclose(g, g.T.conj()) for g in gates) 47 | 48 | return _one_site_workhorse( 49 | peps_tensors, peps_tensor_objs, tuple(gates), real_result 50 | ) 51 | -------------------------------------------------------------------------------- /varipeps/mapping/model.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | import jax.numpy as jnp 4 | 5 | from varipeps.peps import PEPS_Unit_Cell 6 | 7 | from typing import Sequence, Union, List, Tuple 8 | 9 | 10 | class Map_To_PEPS_Model(ABC): 11 | """ 12 | Abstract model of an general callable class to map a sequence of tensors to 13 | a PEPS unitcell. 14 | """ 15 | 16 | @abstractmethod 17 | def __call__( 18 | self, 19 | input_tensors: Sequence[jnp.ndarray], 20 | *, 21 | generate_unitcell: bool = True, 22 | ) -> Union[List[jnp.ndarray], Tuple[List[jnp.ndarray], PEPS_Unit_Cell]]: 23 | """ 24 | Calculate the PEPS unitcell out of a list of input tensors depending on 25 | the original systems. 26 | 27 | Args: 28 | input_tensors (:term:`sequence` of :obj:`jax.numpy.ndarray`): 29 | The sequence of input tensors that should be converted. 30 | Keyword args: 31 | generate_unitcell (:obj:`bool`): 32 | Flag if the only the PEPS tensors or additionally the unitcell 33 | should be calculated. 34 | Returns: 35 | :obj:`list` of :obj:`jax.numpy.ndarray` or :obj:`tuple` of :obj:`list` of :obj:`jax.numpy.ndarray` and :obj:`~varipeps.peps.PEPS_Unit_Cell`: 36 | The mapped PEPS tensors and if ``generate_unitcell = True`` the 37 | unitcell for these tensors. 38 | """ 39 | pass 40 | -------------------------------------------------------------------------------- /varipeps/utils/debug_print.py: -------------------------------------------------------------------------------- 1 | import functools 2 | 3 | from tqdm_loggable.auto import tqdm 4 | 5 | import jax.debug as jdebug 6 | from jax._src.debugging import formatter 7 | 8 | # Adapting function from jax.debug to work with tqdm 9 | 10 | 11 | def _format_print_callback(fmt: str, *args, **kwargs): 12 | tqdm.write(fmt.format(*args, **kwargs)) 13 | 14 | 15 | def debug_print(fmt: str, *args, ordered: bool = True, **kwargs) -> None: 16 | """ 17 | Prints values and works in staged out JAX functions. 18 | 19 | Function adapted from :obj:`jax.debug.print` to work with tqdm. See there 20 | for original authors and function. 21 | 22 | Args: 23 | fmt (:obj:`str`): 24 | A format string, e.g. ``"hello {x}"``, that will be used to format 25 | input arguments. 26 | *args: A list of positional arguments to be formatted. 27 | 28 | Keyword args: 29 | ordered (:obj:`bool`): : 30 | A keyword only argument used to indicate whether or not the 31 | staged out computation will enforce ordering of this ``debug_print`` 32 | w.r.t. other ordered ``debug_print`` calls. 33 | **kwargs: 34 | Additional keyword arguments to be formatted. 35 | """ 36 | # Check that we provide the correct arguments to be formatted 37 | formatter.format(fmt, *args, **kwargs) 38 | 39 | jdebug.callback( 40 | functools.partial(_format_print_callback, fmt), *args, **kwargs, ordered=ordered 41 | ) 42 | -------------------------------------------------------------------------------- /.dir-locals.el: -------------------------------------------------------------------------------- 1 | ((python-mode 2 | (eval . (setq flycheck-python-flake8-executable 3 | (expand-file-name ".venv/bin/python" (locate-dominating-file 4 | default-directory 5 | ".dir-locals.el")))) 6 | (eval . (setq flycheck-python-pylint-executable 7 | (expand-file-name ".venv/bin/python" (locate-dominating-file 8 | default-directory 9 | ".dir-locals.el")))) 10 | (eval . (setq flycheck-python-mypy-executable 11 | (expand-file-name ".venv/bin/mypy" (locate-dominating-file 12 | default-directory 13 | ".dir-locals.el")))) 14 | (eval . (setq flycheck-python-pycompile-executable 15 | (expand-file-name ".venv/bin/python" (locate-dominating-file 16 | default-directory 17 | ".dir-locals.el"))))) 18 | (rst-mode 19 | (eval . (setq flycheck-rst-sphinx-executable 20 | (expand-file-name ".venv/bin/sphinx-build" (locate-dominating-file 21 | default-directory 22 | ".dir-locals.el")))))) 23 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | # This CITATION.cff file was generated with cffinit. 2 | # Visit https://bit.ly/cffinit to generate yours today! 3 | 4 | cff-version: 1.2.0 5 | title: variPEPS (Python version) 6 | message: >- 7 | If you use this software, please cite it using the 8 | metadata from this file. 9 | type: software 10 | authors: 11 | - given-names: Jan 12 | family-names: Naumann 13 | email: j.naumann@fu-berlin.de 14 | affiliation: Freie Universität Berlin 15 | orcid: 'https://orcid.org/0000-0003-4513-5139' 16 | - given-names: Schmoll 17 | family-names: Philipp 18 | affiliation: Freie Universität Berlin 19 | orcid: 'https://orcid.org/0000-0001-5534-6103' 20 | email: philipp.schmoll@fu-berlin.de 21 | - given-names: Losada 22 | family-names: Roberto 23 | affiliation: Freie Universität Berlin 24 | orcid: 'https://orcid.org/0009-0003-7734-1209' 25 | email: roberto.losada@fu-berlin.de 26 | - given-names: Wilde 27 | orcid: 'https://orcid.org/0000-0002-6224-1964' 28 | family-names: Frederik 29 | affiliation: Freie Universität Berlin 30 | - given-names: Krein 31 | family-names: Finn 32 | identifiers: 33 | - type: doi 34 | value: 10.21468/SciPostPhysLectNotes.86 35 | description: Journal article with the description of the method 36 | - type: doi 37 | value: 10.1103/PhysRevB.111.235116 38 | description: Journal article with description of the split-CTMRG method 39 | - type: doi 40 | value: 10.48550/arXiv.2510.04907 41 | description: Preprint with description of the triangular CTMRG method 42 | - type: doi 43 | value: 10.5281/zenodo.10852390 44 | description: Zenodo DOI for current version of the code 45 | repository-code: 'https://github.com/variPEPS/variPEPS_Python' 46 | url: 'https://varipeps.readthedocs.io/en/stable' 47 | abstract: >- 48 | A versatile tensor network library for variational ground 49 | state simulations in two spatial dimensions 50 | keywords: 51 | - physics 52 | - automatic-differentiation 53 | - peps 54 | - tensor-networks 55 | - variational-optimization 56 | - quantum-many-body 57 | - quantum-many-body-physics 58 | license: GPL-3.0-or-later 59 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "variPEPS" 3 | version = "1.3.0" 4 | description = "Versatile tensor network library for variational ground state simulations in two spatial dimensions" 5 | authors = [ 6 | {name = "Jan Naumann", email = "j.naumann@fu-berlin.de"}, 7 | {name = "Philipp Schmoll", email = "philipp.schmoll@fu-berlin.de"}, 8 | {name = "Roberto Losada", email = "roberto.losada@fu-berlin.de"}, 9 | {name = "Frederik Wilde"}, 10 | {name = "Finn Krein"} 11 | ] 12 | license = "GPL-3.0-or-later" 13 | readme = "README.md" 14 | requires-python = ">=3.11" 15 | dependencies = [ 16 | "numpy >= 1.21.2", 17 | "scipy >= 1.7.1", 18 | "jax[cpu]>=0.8.1", 19 | "h5py >= 3.6.0", 20 | "tqdm[notebook] >= 4.64.1", 21 | "tqdm-loggable >= 0.1.3", 22 | ] 23 | keywords = [ 24 | "physics", 25 | "automatic-differentiation", 26 | "peps", 27 | "tensor-networks", 28 | "variational-optimization", 29 | "quantum-many-body", 30 | "quantum-many-body-physics" 31 | ] 32 | classifiers = [ 33 | "Programming Language :: Python :: 3", 34 | "Intended Audience :: Science/Research", 35 | "Topic :: Scientific/Engineering :: Physics", 36 | ] 37 | 38 | [project.urls] 39 | Documentation = "https://varipeps.readthedocs.io/en/stable/" 40 | Repository = "https://github.com/variPEPS/variPEPS_Python" 41 | Issues = "https://github.com/variPEPS/variPEPS_Python/issues" 42 | 43 | [dependency-groups] 44 | dev = [ 45 | "black>=24.10.0", 46 | "flake8>=7.1.1", 47 | "ipython>=8.31.0", 48 | "mypy>=1.14.1", 49 | "pylint>=3.3.3", 50 | ] 51 | 52 | [build-system] 53 | requires = ["hatchling", "scikit-build-core>=0.11.0", "nanobind>=2.7.0", "jaxlib>=0.8.1"] 54 | build-backend = "hatchling.build" 55 | 56 | [tool.scikit-build] 57 | # Protect the configuration against future changes in scikit-build-core 58 | minimum-version = "build-system.requires" 59 | # Setuptools-style build caching in a local directory 60 | build-dir = "build/{wheel_tag}" 61 | 62 | [tool.scikit-build.cmake] 63 | build-type = "Release" 64 | 65 | [tool.hatch.build.targets.wheel.hooks.scikit-build] 66 | experimental = true 67 | 68 | [tool.cibuildwheel] 69 | # Enable free-threaded support 70 | enable = ["cpython-freethreading"] 71 | # Disable building PyPy, musllinux and thread-freethreading on Mac and Windows wheels 72 | skip = ["pp*", "*musllinux*", "*t-win*"] 73 | -------------------------------------------------------------------------------- /varipeps/expectation/model.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from dataclasses import dataclass 3 | 4 | import h5py 5 | 6 | import jax.numpy as jnp 7 | 8 | from varipeps.peps import PEPS_Unit_Cell 9 | 10 | from typing import Sequence, Union, List, Optional 11 | 12 | 13 | @dataclass 14 | class Expectation_Model(ABC): 15 | """ 16 | Abstract model of an general expectation value calculated for the complete 17 | unit cell. 18 | 19 | Parameters: 20 | is_spiral_peps (:obj:`bool`): 21 | Flag if the expectation value is for a spiral iPEPS ansatz. 22 | """ 23 | 24 | @abstractmethod 25 | def __call__( 26 | self, 27 | peps_tensors: Sequence[jnp.ndarray], 28 | unitcell: PEPS_Unit_Cell, 29 | spiral_vectors: Optional[Union[jnp.ndarray, Sequence[jnp.ndarray]]] = None, 30 | *, 31 | normalize_by_size: bool = True, 32 | only_unique: bool = True, 33 | ) -> Union[jnp.ndarray, List[jnp.ndarray]]: 34 | """ 35 | Calculate the expectation value for PEPS unitcell depending on the gates 36 | set in the class. 37 | 38 | Args: 39 | peps_tensors (:term:`sequence` of :obj:`jax.numpy.ndarray`): 40 | The sequence of unique PEPS tensors in the unitcell. 41 | unitcell (:obj:`~varipeps.peps.PEPS_Unit_Cell`): 42 | The PEPS unitcell. 43 | spiral_vectors (single or :term:`sequence` of :obj:`jax.numpy.ndarray`): 44 | If the expectation value is for a spiral iPEPS ansatz, in this 45 | argument the wavevectors are expected. 46 | Keyword args: 47 | normalize_by_size (:obj:`bool`): 48 | Flag if the expectation value should be normalized by the number 49 | of tensors in the unitcell. 50 | only_unique (:obj:`bool`): 51 | Flag if the expectation value should be calculated just once for 52 | each unique PEPS tensor in the unitcell. 53 | Returns: 54 | :obj:`jax.numpy.ndarray` or :obj:`list` of :obj:`jax.numpy.ndarray`: 55 | The expectation values for all gates. Single tensor if only one gate 56 | is applied. 57 | """ 58 | pass 59 | 60 | @abstractmethod 61 | def save_to_group(self, grp: h5py.Group): 62 | pass 63 | 64 | @classmethod 65 | @abstractmethod 66 | def load_from_group(cls, grp: h5py.Group): 67 | pass 68 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Set the minimum CMake version and policies for highest tested version 2 | cmake_minimum_required(VERSION 3.15...3.27) 3 | 4 | # Set default build type in CMake if skbuild is set 5 | message(STATUS "CMAKE_BUILD_TYPE set to '${CMAKE_BUILD_TYPE}'") 6 | 7 | # Set up the project and ensure there is a working C++ compiler 8 | project(varipeps_extensions LANGUAGES CXX) 9 | 10 | # Try to import all Python components potentially needed by nanobind 11 | find_package(Python 3.11 12 | REQUIRED COMPONENTS Interpreter Development.Module 13 | OPTIONAL_COMPONENTS Development.SABIModule) 14 | 15 | # Import nanobind through CMake's find_package mechanism 16 | execute_process( 17 | COMMAND /usr/bin/env python3 -m nanobind --cmake_dir 18 | OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT) 19 | find_package(nanobind CONFIG REQUIRED) 20 | 21 | # Find jaxlib include dir 22 | IF (WIN32) 23 | execute_process( 24 | COMMAND python -c "import inspect; import jaxlib; import pathlib; p = pathlib.Path(inspect.getfile(jaxlib)); print(p.parent / 'include')" 25 | OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE jaxlib_INCLUDE_DIR) 26 | ELSE() 27 | execute_process( 28 | COMMAND /usr/bin/env python3 -c "import inspect; import jaxlib; import pathlib; p = pathlib.Path(inspect.getfile(jaxlib)); print(p.parent / 'include')" 29 | OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE jaxlib_INCLUDE_DIR) 30 | ENDIF() 31 | 32 | 33 | # We are now ready to compile the actual extension module 34 | nanobind_add_module( 35 | # Name of the extension 36 | _svd_only_u_vt 37 | 38 | # Target the stable ABI for Python 3.12+, which reduces 39 | # the number of binary wheels that must be built. This 40 | # does nothing on older Python versions 41 | STABLE_ABI 42 | 43 | # Build libnanobind statically and merge it into the 44 | # extension (which itself remains a shared library) 45 | # 46 | # If your project builds multiple extensions, you can 47 | # replace this flag by NB_SHARED to conserve space by 48 | # reusing a shared libnanobind across libraries 49 | NB_STATIC 50 | 51 | # Source code goes here 52 | varipeps/utils/extensions/svd_ffi.cpp 53 | ) 54 | 55 | target_include_directories(_svd_only_u_vt PRIVATE "${jaxlib_INCLUDE_DIR}") 56 | 57 | # target_link_libraries(_svd_only_vt PRIVATE lapack) 58 | 59 | # Install directive for scikit-build-core 60 | install(TARGETS _svd_only_u_vt LIBRARY DESTINATION varipeps/utils/extensions) 61 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_left.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope} 21 | 22 | % label 23 | \node at (-3.5,0) {\large$\rho_\text{DL}^{[x+1,y]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T3) at (-1.5, -1.5); 29 | \coordinate (C4) at (-3.5, -1.5); 30 | \coordinate (T4) at (-2.0, -0.0); 31 | 32 | % external links 33 | \draw[ultra thick] ($(T3) + (+1.50, +0.00)$) to (T3) node at ($(T3) + (+2.00, +0.00)$) {$-1$}; 34 | \draw[thick] ($(PC) + (+1.00, +0.00)$) to (PC) node at ($(PC) + (+1.50, +0.00)$) {$-2$}; 35 | \draw[thick] ($(PN) + (+2.00, +0.00)$) to (PN) node at ($(PN) + (+2.50, +0.00)$) {$-3$}; 36 | \draw[ultra thick] ($(T4) + (+1.25, +1.25)$) to (T4) node at ($(T4) + (+1.50, +1.50)$) {$-4$}; 37 | \draw[thick] ($(PN) + (+0.75, +0.75)$) to (PN) node at ($(PN) + (+1.00, +1.00)$) {$-5$}; 38 | \draw[thick] ($(PC) + (+1.75, +1.75)$) to (PC) node at ($(PC) + (+2.00, +2.00)$) {$-6$}; 39 | 40 | % internal links 41 | \draw[ultra thick] (T4) to (C4) node[left = 0.25] at ($(T4)!0.5!(C4)$) {$1$}; 42 | \draw[thick] (PC) to [out = 180, in = 0] (T4) node[below] at ($(PC)!0.7!(T4)$) {$5$}; 43 | \draw[ultra thick] (T3) -- (C4) node [midway, below] {$2$}; 44 | \draw[thick] (PC) to [out = 225, in = 45] (T3) node[below right] at ($(PC)!0.3!(T3)$) {$6$}; 45 | \draw[thick] (PN) to [out = 180, in = 0] (T4) node[above] at ($(PN)!0.3!(T4)$) {$3$}; 46 | \draw[thick] (PN) to [out = 225, in = 45] (T3) node[left] at ($(PN)!0.7!(T3)$) {$4$}; 47 | \draw[thick] (PN) -- (PC) node [midway, right] {$7$}; 48 | 49 | % CTMRG tensors 50 | \foreach \tensor in {T3, C4, T4} { 51 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 52 | } 53 | 54 | % iPEPS tensors 55 | \foreach \tensor in {PN, PC} { 56 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 57 | } 58 | 59 | \end{scope} 60 | 61 | \end{tikzpicture} 62 | 63 | \end{document} 64 | 65 | %%% Local Variables: 66 | %%% mode: latex 67 | %%% TeX-master: t 68 | %%% End: 69 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_right.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope} 21 | 22 | % label 23 | \node at (+3.5,0) {\large$\rho_\text{DR}^{[x+1,y+1]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T2) at (+2.0, -0.0); 29 | \coordinate (C3) at (+0.5, -1.5); 30 | \coordinate (T3) at (-1.5, -1.5); 31 | 32 | % external links 33 | \draw[ultra thick] ($(T2) + (+1.25, +1.25)$) to (T2) node at ($(T2) + (+1.50, +1.50)$) {$-1$}; 34 | \draw[thick] ($(PC) + (+1.75, +1.75)$) to (PC) node at ($(PC) + (+2.00, +2.00)$) {$-2$}; 35 | \draw[thick] ($(PN) + (+0.75, +0.75)$) to (PN) node at ($(PN) + (+1.00, +1.00)$) {$-3$}; 36 | \draw[ultra thick] ($(T3) + (-1.50, +0.00)$) to (T3) node at ($(T3) + (-2.00, +0.00)$) {$-4$}; 37 | \draw[thick] (PC) to ($(PC) + (-2.00, +0.00)$) node at ($(PC) + (-2.50, +0.00)$) {$-5$}; 38 | \draw[thick] (PN) to ($(PN) + (-1.00, +0.00)$) node at ($(PN) + (-1.50, +0.00)$) {$-6$}; 39 | 40 | % internal links 41 | \draw[ultra thick] (T2) to (C3) node[right = 0.25] at ($(T2)!0.5!(C3)$) {$2$}; 42 | \draw[thick] (T2) to [out = 180, in = 0] (PC) node[below] at ($(T2)!0.7!(PC)$) {$6$}; 43 | \draw[ultra thick] (C3) -- (T3) node [midway, below] {$1$}; 44 | \draw[thick] (PC) to [out = 225, in = 45] (T3) node[below right] at ($(PC)!0.3!(T3)$) {$5$}; 45 | \draw[thick] (T2) to [out = 180, in = 0] (PN) node[above] at ($(T2)!0.3!(PN)$) {$4$}; 46 | \draw[thick] (PN) to [out = 225, in = 45] (T3) node[left] at ($(PN)!0.7!(T3)$) {$3$}; 47 | \draw[thick] (PN) -- (PC) node [midway, right] {$7$}; 48 | 49 | % CTMRG tensors 50 | \foreach \tensor in {T2, C3, T3} { 51 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 52 | } 53 | 54 | % iPEPS tensors 55 | \foreach \tensor in {PN, PC} { 56 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 57 | } 58 | 59 | \end{scope} 60 | 61 | \end{tikzpicture} 62 | 63 | \end{document} 64 | 65 | %%% Local Variables: 66 | %%% mode: latex 67 | %%% TeX-master: t 68 | %%% End: 69 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_L_C4.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\ballSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{LU} 39 | \begin{scope}[shift = {(-1.00, +0.00)}] 40 | \coordinate (PUL) at (-1.50, -0.50); 41 | \coordinate (PUM) at (+0.00, -0.50); 42 | \coordinate (PUR) at (+1.00, -0.50); 43 | \coordinate (PUU) at (+0.50, +0.00); 44 | \node[] at (-1.50, -0.00) {$P_\text{L(U)}^{[x, y]}$}; 45 | \end{scope} 46 | 47 | % tensor labels 48 | \node[below = 0.25] at (C4) {$C_{4}^{[x,y]}$}; 49 | \node[below = 0.25] at (T3) {$T_{3}^{[x,y]}$}; 50 | 51 | % external links 52 | \draw[ultra thick] (PUU) to ($(PUU) + (+0.75, +0.75)$) node at ($(PUU) + (+1.00, +1.00)$) {$-2$}; 53 | \draw[ultra thick] (T3) to ($(T3) + (+1.50, +0.00)$) node at ($(T3) + (+2.00, +0.00)$) {$-1$}; 54 | 55 | % projector 56 | \draw[thick, fill = gray!25] (PUL) to (PUR) to (PUU) -- cycle; 57 | 58 | % internal links 59 | \draw[ultra thick] (C4) -- (PUL) node[left = 0.25] at ($(C4)!0.5!(PUL)$) {$2$}; 60 | \draw[ultra thick] (C4) -- (T3) node [midway, below] {$1$}; 61 | \draw[thick] (T3) to [out = 45, in = 225] (PUM) node[left = 0.25] at ($(T3)!0.5!(PUM)$) {$3$}; 62 | \draw[thick] (T3) to [out = 45, in = 225] (PUR) node[right] at ($(T3)!0.5!(PUR)$) {$4$}; 63 | 64 | % CTMRG tensors 65 | \foreach \tensor in {T3, C4} { 66 | \draw[thick,black,fill = gray] (\tensor) circle (\ballSize); 67 | } 68 | 69 | \end{scope} 70 | 71 | \end{tikzpicture} 72 | 73 | \end{document} 74 | %%% Local Variables: 75 | %%% mode: latex 76 | %%% TeX-master: t 77 | %%% End: 78 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_R_C3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\ballSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{RU} 39 | \begin{scope}[shift = {(+0.50, +0.00)}] 40 | \coordinate (PUL) at (-1.50, -0.50); 41 | \coordinate (PUM) at (-0.50, -0.50); 42 | \coordinate (PUR) at (+1.00, -0.50); 43 | \coordinate (PUU) at (+0.50, +0.00); 44 | \node[] at (+1.50, -0.00) {$P_\text{R(U)}^{[x, y]}$}; 45 | \end{scope} 46 | 47 | % tensor labels 48 | \node[below = 0.25] at (C3) {$C_{3}^{[x,y]}$}; 49 | \node[below = 0.25] at (T3) {$T_{3}^{[x,y]}$}; 50 | 51 | % external links 52 | \draw[ultra thick] (PUU) to ($(PUU) + (+0.75, +0.75)$) node at ($(PUU) + (+1.00, +1.00)$) {$-2$}; 53 | \draw[ultra thick] (T3) to ($(T3) + (-1.50, +0.00)$) node at ($(T3) + (-2.00, +0.00)$) {$-1$}; 54 | 55 | % projector 56 | \draw[thick, fill = gray!25] (PUL) to (PUR) to (PUU) -- cycle; 57 | 58 | % internal links 59 | \draw[ultra thick] (C3) -- (PUR) node[right = 0.25] at ($(C3)!0.5!(PUR)$) {$2$}; 60 | \draw[ultra thick] (C3) -- (T3) node [midway, below] {$1$}; 61 | \draw[thick] (T3) to [out = 45, in = 225] (PUM) node[below right] at ($(T3)!0.5!(PUM)$) {$3$}; 62 | \draw[thick] (T3) to [out = 45, in = 225] (PUL) node[left] at ($(T3)!0.5!(PUL)$) {$4$}; 63 | 64 | % CTMRG tensors 65 | \foreach \tensor in {T3, C3} { 66 | \draw[thick,black,fill = gray] (\tensor) circle (\ballSize); 67 | } 68 | 69 | \end{scope} 70 | 71 | \end{tikzpicture} 72 | 73 | \end{document} 74 | %%% Local Variables: 75 | %%% mode: latex 76 | %%% TeX-master: t 77 | %%% End: 78 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_U_C2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{UL} 39 | \begin{scope}[shift = {(-1.50, +0.50)}] 40 | \coordinate (PLL) at (+0.00, +0.00); 41 | \coordinate (PLU) at (+2.00, +1.00); 42 | \coordinate (PLM) at (+1.00, +0.00); 43 | \coordinate (PLD) at (+0.00, -1.00); 44 | \node[] at (+0.00, +1.00) {$P_\text{U(L)}^{[x, y]}$}; 45 | \end{scope} 46 | 47 | % tensor labels 48 | \node[above = 0.25] at (C2) {$C_{2}^{[x, y]}$}; 49 | \node[right = 0.25] at (T2) {$T_{2}^{[x, y]}$}; 50 | 51 | % external links 52 | \draw[ultra thick] (PLL) to ($(PLL) + (-1.50, +0.00)$) node at ($(PLL) + (-2.00, +0.00)$) {$-1$}; 53 | \draw[ultra thick] (T2) to ($(T2) + (-0.75, -0.75)$) node at ($(T2) + (-1.00, -1.00)$) {$-2$}; 54 | 55 | % projector 56 | \draw[thick, fill = gray!25] (PLL) to (PLU) to (PLD) -- cycle; 57 | 58 | % internal links 59 | \draw[ultra thick] (C2) -- (PLU) node[above] at ($(C2)!0.5!(PLU)$) {$2$}; 60 | \draw[ultra thick] (C2) -- (T2) node [midway, right = 0.25] {$1$}; 61 | \draw[thick] (T2) to [out = 180, in = 0] (PLM) node[above] at ($(T2)!0.5!(PLM)$) {$3$}; 62 | \draw[thick] (T2) to [out = 180, in = 0] (PLD) node[below] at ($(T2)!0.5!(PLD)$) {$4$}; 63 | 64 | % CTMRG tensors 65 | \foreach \tensor in {C2, T2} { 66 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 67 | } 68 | 69 | \end{scope} 70 | 71 | \end{tikzpicture} 72 | 73 | \end{document} 74 | %%% Local Variables: 75 | %%% mode: latex 76 | %%% TeX-master: t 77 | %%% End: 78 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_left_large_d.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope} 21 | 22 | % label 23 | \node at (-3.5,0) {\large$\rho_\text{DL}^{[x+1,y]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T3) at (-1.5, -1.5); 29 | \coordinate (C4) at (-3.5, -1.5); 30 | \coordinate (T4) at (-2.0, -0.0); 31 | 32 | % external links 33 | \draw[ultra thick] ($(T3) + (+1.50, +0.00)$) to (T3) node at ($(T3) + (+2.00, +0.00)$) {$-1$}; 34 | \draw[thick] ($(PC) + (+1.00, +0.00)$) to (PC) node at ($(PC) + (+1.50, +0.00)$) {$-2$}; 35 | \draw[thick] ($(PN) + (+2.00, +0.00)$) to (PN) node at ($(PN) + (+2.50, +0.00)$) {$-3$}; 36 | \draw[ultra thick] ($(T4) + (+1.25, +1.25)$) to (T4) node at ($(T4) + (+1.50, +1.50)$) {$-4$}; 37 | \draw[thick] ($(PN) + (+0.75, +0.75)$) to (PN) node at ($(PN) + (+1.00, +1.00)$) {$-5$}; 38 | \draw[thick] ($(PC) + (+1.75, +1.75)$) to (PC) node at ($(PC) + (+2.00, +2.00)$) {$-6$}; 39 | 40 | % internal links 41 | \draw[ultra thick] (T4) to (C4) node[left = 0.25] at ($(T4)!0.5!(C4)$) {$1$}; 42 | \draw[thick] (PC) to [out = 180, in = 0] (T4) node[below] at ($(PC)!0.7!(T4)$) {$6$}; 43 | \draw[ultra thick] (T3) -- (C4) node [midway, below] {$2$}; 44 | \draw[thick] (PC) to [out = 225, in = 45] (T3) node[below right] at ($(PC)!0.3!(T3)$) {$7$}; 45 | \draw[thick] (PN) to [out = 180, in = 0] (T4) node[above] at ($(PN)!0.3!(T4)$) {$4$}; 46 | \draw[thick] (PN) to [out = 225, in = 45] (T3) node[left] at ($(PN)!0.7!(T3)$) {$5$}; 47 | \draw[thick] (PN) -- (PC) node [midway, right] {$3$}; 48 | 49 | % CTMRG tensors 50 | \foreach \tensor in {T3, C4, T4} { 51 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 52 | } 53 | 54 | % iPEPS tensors 55 | \foreach \tensor in {PN, PC} { 56 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 57 | } 58 | 59 | \end{scope} 60 | 61 | \end{tikzpicture} 62 | 63 | \end{document} 64 | 65 | %%% Local Variables: 66 | %%% mode: latex 67 | %%% TeX-master: t 68 | %%% End: 69 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_bottom_right_large_d.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope} 21 | 22 | % label 23 | \node at (+3.5,0) {\large$\rho_\text{DR}^{[x+1,y+1]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T2) at (+2.0, -0.0); 29 | \coordinate (C3) at (+0.5, -1.5); 30 | \coordinate (T3) at (-1.5, -1.5); 31 | 32 | % external links 33 | \draw[ultra thick] ($(T2) + (+1.25, +1.25)$) to (T2) node at ($(T2) + (+1.50, +1.50)$) {$-1$}; 34 | \draw[thick] ($(PC) + (+1.75, +1.75)$) to (PC) node at ($(PC) + (+2.00, +2.00)$) {$-2$}; 35 | \draw[thick] ($(PN) + (+0.75, +0.75)$) to (PN) node at ($(PN) + (+1.00, +1.00)$) {$-3$}; 36 | \draw[ultra thick] ($(T3) + (-1.50, +0.00)$) to (T3) node at ($(T3) + (-2.00, +0.00)$) {$-4$}; 37 | \draw[thick] (PC) to ($(PC) + (-2.00, +0.00)$) node at ($(PC) + (-2.50, +0.00)$) {$-5$}; 38 | \draw[thick] (PN) to ($(PN) + (-1.00, +0.00)$) node at ($(PN) + (-1.50, +0.00)$) {$-6$}; 39 | 40 | % internal links 41 | \draw[ultra thick] (T2) to (C3) node[right = 0.25] at ($(T2)!0.5!(C3)$) {$2$}; 42 | \draw[thick] (T2) to [out = 180, in = 0] (PC) node[below] at ($(T2)!0.7!(PC)$) {$7$}; 43 | \draw[ultra thick] (C3) -- (T3) node [midway, below] {$1$}; 44 | \draw[thick] (PC) to [out = 225, in = 45] (T3) node[below right] at ($(PC)!0.3!(T3)$) {$6$}; 45 | \draw[thick] (T2) to [out = 180, in = 0] (PN) node[above] at ($(T2)!0.3!(PN)$) {$5$}; 46 | \draw[thick] (PN) to [out = 225, in = 45] (T3) node[left] at ($(PN)!0.7!(T3)$) {$4$}; 47 | \draw[thick] (PN) -- (PC) node [midway, right] {$3$}; 48 | 49 | % CTMRG tensors 50 | \foreach \tensor in {T2, C3, T3} { 51 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 52 | } 53 | 54 | % iPEPS tensors 55 | \foreach \tensor in {PN, PC} { 56 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 57 | } 58 | 59 | \end{scope} 60 | 61 | \end{tikzpicture} 62 | 63 | \end{document} 64 | 65 | %%% Local Variables: 66 | %%% mode: latex 67 | %%% TeX-master: t 68 | %%% End: 69 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_D_C3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{UL} 39 | \begin{scope}[shift = {(-1.50, -0.50)}] 40 | \coordinate (PLL) at (+0.00, +0.00); 41 | \coordinate (PLU) at (+2.00, +1.00); 42 | \coordinate (PLM) at (+1.00, +0.00); 43 | \coordinate (PLD) at (+0.00, -1.00); 44 | \node[] at (+0.00, +1.00) {$P_\text{D(L)}^{[x, y]}$}; 45 | \end{scope} 46 | 47 | % tensor labels 48 | \node[right = 0.25] at (T2) {$T_{2}^{[x, y]}$}; 49 | \node[below = 0.25] at (C3) {$C_{3}^{[x, y]}$}; 50 | 51 | % external links 52 | \draw[ultra thick] (PLL) to ($(PLL) + (-1.50, +0.00)$) node at ($(PLL) + (-2.00, +0.00)$) {$-1$}; 53 | \draw[ultra thick] (T2) to ($(T2) + (+0.75, +0.75)$) node at ($(T2) + (+1.00, +1.00)$) {$-2$}; 54 | 55 | % projector 56 | \draw[thick, fill = gray!25] (PLL) to (PLU) to (PLD) -- cycle; 57 | 58 | % internal links 59 | \draw[ultra thick] (C3) -- (PLD) node[above] at ($(C3)!0.5!(PLD)$) {$2$}; 60 | \draw[ultra thick] (C3) -- (T2) node [midway, right = 0.25] {$1$}; 61 | \draw[thick] (T2) to [out = 180, in = 0] (PLU) node[above] at ($(T2)!0.5!(PLU)$) {$4$}; 62 | \draw[thick] (T2) to [out = 180, in = 0] (PLM) node[below] at ($(T2)!0.5!(PLM)$) {$3$}; 63 | 64 | % CTMRG tensors 65 | \foreach \tensor in {C3, T2} { 66 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 67 | } 68 | 69 | \end{scope} 70 | 71 | \end{tikzpicture} 72 | 73 | \end{document} 74 | 75 | %%% Local Variables: 76 | %%% mode: latex 77 | %%% TeX-master: t 78 | %%% End: 79 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_D_C4.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{UR} 39 | \begin{scope}[shift = {(+0.50, -0.50)}] 40 | \coordinate (PRU) at (+0.00, +1.00); 41 | \coordinate (PRM) at (-1.00, -0.00); 42 | \coordinate (PRD) at (-2.00, -1.00); 43 | \coordinate (PRR) at (+0.00, +0.00); 44 | \node[] at (-0.00, -1.00) {$P_\text{D(R)}^{[x, y - 1]}$}; 45 | \end{scope} 46 | 47 | % tensor labels 48 | \node[below = 0.25] at (C4) {$C_{4}^{[x, y]}$}; 49 | \node[left = 0.25] at (T4) {$T_{4}^{[x, y]}$}; 50 | 51 | % external links 52 | \draw[ultra thick] (PRR) to ($(PRR) + (+1.50, +0.00)$) node at ($(PRR) + (+2.00, +0.00)$) {$-1$}; 53 | \draw[ultra thick] (T4) to ($(T4) + (+0.75, +0.75)$) node at ($(T4) + (+1.00, +1.00)$) {$-2$}; 54 | 55 | % projector 56 | \draw[thick, fill = gray!25] (PRR) to (PRU) to (PRD) -- cycle; 57 | 58 | % internal links 59 | \draw[ultra thick] (PRD) -- (C4) node[above] at ($(C4)!0.5!(PRD)$) {$2$}; 60 | \draw[ultra thick] (C4) -- (T4) node [midway, left = 0.25] {$1$}; 61 | \draw[thick] (PRU) to [out = 180, in = 0] (T4) node[above] at ($(PRU)!0.5!(T4)$) {$4$}; 62 | \draw[thick] (PRM) to [out = 180, in = 0] (T4) node[below] at ($(PRM)!0.5!(T4)$) {$3$}; 63 | 64 | % CTMRG tensors 65 | \foreach \tensor in {T4, C4} { 66 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 67 | } 68 | 69 | \end{scope} 70 | 71 | \end{tikzpicture} 72 | 73 | \end{document} 74 | %%% Local Variables: 75 | %%% mode: latex 76 | %%% TeX-master: t 77 | %%% End: 78 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_L_C1.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | % contant definitions 18 | \def\tensorSize{0.2} 19 | 20 | % tensor network contraction 21 | \begin{scope} 22 | 23 | % iPEPS network coordinates 24 | \coordinate (PN) at (+0.0, +0.5); 25 | \coordinate (PC) at (+0.0, -0.5); 26 | 27 | % CTMRG network coordinates 28 | \coordinate (C1) at (-0.5, +1.5); 29 | \coordinate (T1) at (+1.5, +1.5); 30 | \coordinate (C2) at (+3.5, +1.5); 31 | \coordinate (T2) at (+2.0, +0.0); 32 | \coordinate (C3) at (+0.5, -1.5); 33 | \coordinate (T3) at (-1.5, -1.5); 34 | \coordinate (C4) at (-3.5, -1.5); 35 | \coordinate (T4) at (-2.0, -0.0); 36 | 37 | % projector P_{LD} 38 | \begin{scope}[shift = {(-0.50, -0.00)}] 39 | \coordinate (PDL) at (-1.00, +0.50); 40 | \coordinate (PDM) at (+0.50, +0.50); 41 | \coordinate (PDR) at (+1.50, +0.50); 42 | \coordinate (PDD) at (-0.50, +0.00); 43 | \node[] at (-1.50, -0.00) {$P_\text{L(D)}^{[x - 1, y]}$}; 44 | \end{scope} 45 | 46 | % tensor labels 47 | \node[above = 0.25] at (C1) {$C_{1}^{[x, y]}$}; 48 | \node[above = 0.25] at (T1) {$T_{1}^{[x, y]}$}; 49 | 50 | % external links 51 | \draw[ultra thick] (PDD) to ($(PDD) + (-0.75, -0.75)$) node at ($(PDD) + (-1.00, -1.00)$) {$-1$}; 52 | \draw[ultra thick] (T1) to ($(T1) + (+1.50, +0.00)$) node at ($(T1) + (+2.00, +0.00)$) {$-2$}; 53 | 54 | % projector 55 | \draw[thick, fill = gray!25] (PDL) to (PDR) to (PDD) -- cycle; 56 | 57 | % internal links 58 | \draw[ultra thick] (C1) -- (PDL) node[left = 0.25] at ($(C1)!0.5!(PDL)$) {$2$}; 59 | \draw[ultra thick] (C1) -- (T1) node [midway, above] {$1$}; 60 | \draw[thick] (T1) to [out = 225, in = 45] (PDM) node[left = 0.25] at ($(T1)!0.5!(PDM)$) {$3$}; 61 | \draw[thick] (T1) to [out = 225, in = 45] (PDR) node[right] at ($(T1)!0.5!(PDR)$) {$4$}; 62 | 63 | % CTMRG tensors 64 | \foreach \tensor in {C1, T1} { 65 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 66 | } 67 | 68 | \end{scope} 69 | 70 | \end{tikzpicture} 71 | 72 | \end{document} 73 | %%% Local Variables: 74 | %%% mode: latex 75 | %%% TeX-master: t 76 | %%% End: 77 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_U_C1.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{UR} 39 | \begin{scope}[shift = {(+1.50, +0.50)}] 40 | \coordinate (PRU) at (+0.00, +1.00); 41 | \coordinate (PRM) at (-1.00, -0.00); 42 | \coordinate (PRD) at (-2.00, -1.00); 43 | \coordinate (PRR) at (+0.00, +0.00); 44 | \node[] at (-0.00, -1.00) {$P_\text{U(R)}^{[x, y - 1]}$}; 45 | \end{scope} 46 | 47 | % tensor labels 48 | \node[above = 0.25] at (C1) {$C_{1}^{[x, y]}$}; 49 | \node[left = 0.25] at (T4) {$T_{4}^{[x, y]}$}; 50 | 51 | % external links 52 | \draw[ultra thick] (PRR) to ($(PRR) + (+1.50, +0.00)$) node at ($(PRR) + (+2.00, +0.00)$) {$-2$}; 53 | \draw[ultra thick] (T4) to ($(T4) + (-0.75, -0.75)$) node at ($(T4) + (-1.00, -1.00)$) {$-1$}; 54 | 55 | % projector 56 | \draw[thick, fill = gray!25] (PRR) to (PRU) to (PRD) -- cycle; 57 | 58 | % internal links 59 | \draw[ultra thick] (PRU) -- (C1) node[above] at ($(C1)!0.5!(PRU)$) {$2$}; 60 | \draw[ultra thick] (C1) -- (T4) node [midway, left = 0.25] {$1$}; 61 | \draw[thick] (PRM) to [out = 180, in = 0] (T4) node[above] at ($(PRM)!0.5!(T4)$) {$3$}; 62 | \draw[thick] (PRD) to [out = 180, in = 0] (T4) node[below] at ($(PRD)!0.5!(T4)$) {$4$}; 63 | 64 | % CTMRG tensors 65 | \foreach \tensor in {T4, C1} { 66 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 67 | } 68 | 69 | \end{scope} 70 | 71 | \end{tikzpicture} 72 | 73 | \end{document} 74 | %%% Local Variables: 75 | %%% mode: latex 76 | %%% TeX-master: t 77 | %%% End: 78 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_top_left.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope}[shift = {(-3, +2)}] 21 | 22 | % label 23 | \node at (-3.5,0) {\large$\rho_\text{UL}^{[x,y]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T4) at (-2.0, -0.0); 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | 32 | % external links 33 | \draw[ultra thick] (T4) to ($(T4) + (-1.25, -1.25)$) node at ($(T4) + (-1.50, -1.50)$) {$-1$}; 34 | \draw[thick] (PN) to ($(PN) + (-1.75, -1.75)$) node at ($(PN) + (-2.00, -2.00)$) {$-2$}; 35 | \draw[thick] (PC) to ($(PC) + (-0.75, -0.75)$) node at ($(PC) + (-1.00, -1.00)$) {$-3$}; 36 | \draw[ultra thick] (T1) to ($(T1) + (+1.50, +0.00)$) node at ($(T1) + (+2.00, +0.00)$) {$-4$}; 37 | \draw[thick] (PN) to ($(PN) + (+2.00, +0.00)$) node at ($(PN) + (+2.50, +0.00)$) {$-5$}; 38 | \draw[thick] (PC) to ($(PC) + (+1.00, +0.00)$) node at ($(PC) + (+1.50, +0.00)$) {$-6$}; 39 | 40 | 41 | % internal links 42 | \draw[ultra thick] (C1) -- (T4) node[left = 0.25] at ($(C1)!0.5!(T4)$) {$1$}; 43 | \draw[thick] (T4) to [out = 0, in = 180] (PC) node[below] at ($(T4)!0.3!(PC)$) {$5$}; 44 | \draw[ultra thick] (C1) -- (T1) node [midway, above] {$2$}; 45 | \draw[thick] (T1) to [out = 225, in = 45] (PC) node[right] at ($(T1)!0.3!(PC)$) {$6$}; 46 | \draw[thick] (T4) to [out = 0, in = 180] (PN) node[above] at ($(T4)!0.7!(PN)$) {$3$}; 47 | \draw[thick] (T1) to [out = 225, in = 45] (PN) node[above left] at ($(T1)!0.7!(PN)$) {$4$}; 48 | \draw[thick] (PN) -- (PC) node [midway, right] {$7$}; 49 | 50 | % CTMRG tensors 51 | \foreach \tensor in {T4, C1, T1} { 52 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 53 | } 54 | 55 | % iPEPS tensors 56 | \foreach \tensor in {PN, PC} { 57 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 58 | } 59 | 60 | \end{scope} 61 | 62 | \end{tikzpicture} 63 | 64 | \end{document} 65 | 66 | %%% Local Variables: 67 | %%% mode: latex 68 | %%% TeX-master: t 69 | %%% End: 70 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_top_left_large_d.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope}[shift = {(-3, +2)}] 21 | 22 | % label 23 | \node at (-3.5,0) {\large$\rho_\text{UL}^{[x,y]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T4) at (-2.0, -0.0); 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | 32 | % external links 33 | \draw[ultra thick] (T4) to ($(T4) + (-1.25, -1.25)$) node at ($(T4) + (-1.50, -1.50)$) {$-1$}; 34 | \draw[thick] (PN) to ($(PN) + (-1.75, -1.75)$) node at ($(PN) + (-2.00, -2.00)$) {$-2$}; 35 | \draw[thick] (PC) to ($(PC) + (-0.75, -0.75)$) node at ($(PC) + (-1.00, -1.00)$) {$-3$}; 36 | \draw[ultra thick] (T1) to ($(T1) + (+1.50, +0.00)$) node at ($(T1) + (+2.00, +0.00)$) {$-4$}; 37 | \draw[thick] (PN) to ($(PN) + (+2.00, +0.00)$) node at ($(PN) + (+2.50, +0.00)$) {$-5$}; 38 | \draw[thick] (PC) to ($(PC) + (+1.00, +0.00)$) node at ($(PC) + (+1.50, +0.00)$) {$-6$}; 39 | 40 | 41 | % internal links 42 | \draw[ultra thick] (C1) -- (T4) node[left = 0.25] at ($(C1)!0.5!(T4)$) {$1$}; 43 | \draw[thick] (T4) to [out = 0, in = 180] (PC) node[below] at ($(T4)!0.3!(PC)$) {$6$}; 44 | \draw[ultra thick] (C1) -- (T1) node [midway, above] {$2$}; 45 | \draw[thick] (T1) to [out = 225, in = 45] (PC) node[right] at ($(T1)!0.3!(PC)$) {$7$}; 46 | \draw[thick] (T4) to [out = 0, in = 180] (PN) node[above] at ($(T4)!0.7!(PN)$) {$4$}; 47 | \draw[thick] (T1) to [out = 225, in = 45] (PN) node[above left] at ($(T1)!0.7!(PN)$) {$5$}; 48 | \draw[thick] (PN) -- (PC) node [midway, right] {$3$}; 49 | 50 | % CTMRG tensors 51 | \foreach \tensor in {T4, C1, T1} { 52 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 53 | } 54 | 55 | % iPEPS tensors 56 | \foreach \tensor in {PN, PC} { 57 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 58 | } 59 | 60 | \end{scope} 61 | 62 | \end{tikzpicture} 63 | 64 | \end{document} 65 | 66 | %%% Local Variables: 67 | %%% mode: latex 68 | %%% TeX-master: t 69 | %%% End: 70 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_top_right.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope}[shift = {(+3, +2)}] 21 | 22 | % label 23 | \node at (+3.5,0) {\large$\rho_\text{UR}^{[x,y + 1]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T1) at (+1.5, +1.5); 29 | \coordinate (C2) at (+3.5, +1.5); 30 | \coordinate (T2) at (+2.0, -0.0); 31 | 32 | % external links 33 | \draw[ultra thick] (T1) to ($(T1) + (-1.50, +0.00)$) node at ($(T1) + (-2.00, +0.00)$) {$-1$}; 34 | \draw[thick] (PN) to ($(PN) + (-1.00, +0.00)$) node at ($(PN) + (-1.50, +0.00)$) {$-2$}; 35 | \draw[thick] (PC) to ($(PC) + (-2.00, +0.00)$) node at ($(PC) + (-2.50, +0.00)$) {$-3$}; 36 | \draw[ultra thick] (T2) to ($(T2) + (-1.25, -1.25)$) node at ($(T2) + (-1.50, -1.50)$) {$-4$}; 37 | \draw[thick] (PC) to ($(PC) + (-0.75, -0.75)$) node at ($(PC) + (-1.00, -1.00)$) {$-5$}; 38 | \draw[thick] (PN) to ($(PN) + (-1.75, -1.75)$) node at ($(PN) + (-2.00, -2.00)$) {$-6$}; 39 | 40 | 41 | % internal links 42 | \draw[ultra thick] (C2) to (T2) node[right = 0.25] at ($(C2)!0.5!(T2)$) {$2$}; 43 | \draw[thick] (T2) to [out = 180, in = 0] (PC) node[below] at ($(T2)!0.7!(PC)$) {$6$}; 44 | \draw[ultra thick] (C2) -- (T1) node [midway, above] {$1$}; 45 | \draw[thick] (T1) to [out = 225, in = 45] (PC) node[right] at ($(T1)!0.3!(PC)$) {$5$}; 46 | \draw[thick] (T2) to [out = 180, in = 0] (PN) node[above] at ($(T2)!0.3!(PN)$) {$4$}; 47 | \draw[thick] (T1) to [out = 225, in = 45] (PN) node[above left] at ($(T1)!0.7!(PN)$) {$3$}; 48 | \draw[thick] (PN) -- (PC) node [midway, right] {$7$}; 49 | 50 | % CTMRG tensors 51 | \foreach \tensor in {T1, C2, T2} { 52 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 53 | } 54 | 55 | % iPEPS tensors 56 | \foreach \tensor in {PN, PC} { 57 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 58 | } 59 | 60 | \end{scope} 61 | 62 | \end{tikzpicture} 63 | 64 | \end{document} 65 | 66 | %%% Local Variables: 67 | %%% mode: latex 68 | %%% TeX-master: t 69 | %%% End: 70 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_R_C2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % P_{RD} 39 | % projector P_{RD} 40 | \begin{scope}[shift = {(+1.00, -0.00)}] 41 | \coordinate (PDL) at (-1.00, +0.50); 42 | \coordinate (PDM) at (+0.00, +0.50); 43 | \coordinate (PDR) at (+1.50, +0.50); 44 | \coordinate (PDD) at (-0.50, +0.00); 45 | \node[] at (+1.50, -0.00) {$P_\text{R(D)}^{[x - 1, y]}$}; 46 | \end{scope} 47 | 48 | % tensor labels 49 | \node[above = 0.25] at (C2) {$C_{2}^{[x, y]}$}; 50 | \node[above = 0.25] at (T1) {$T_{1}^{[x, y]}$}; 51 | 52 | % external links 53 | \draw[ultra thick] (PDD) to ($(PDD) + (-0.75, -0.75)$) node at ($(PDD) + (-1.00, -1.00)$) {$-2$}; 54 | \draw[ultra thick] (T1) to ($(T1) + (-1.50, +0.00)$) node at ($(T1) + (-2.00, +0.00)$) {$-1$}; 55 | 56 | % projector 57 | \draw[thick, fill = gray!25] (PDL) to (PDR) to (PDD) -- cycle; 58 | 59 | % internal links 60 | \draw[ultra thick] (C2) -- (PDR) node[right = 0.25] at ($(C2)!0.5!(PDR)$) {$2$}; 61 | \draw[ultra thick] (C2) -- (T1) node [midway, above] {$1$}; 62 | \draw[thick] (T1) to [out = 225, in = 45] (PDM) node[right] at ($(T1)!0.5!(PDM)$) {$3$}; 63 | \draw[thick] (T1) to [out = 225, in = 45] (PDL) node[above left] at ($(T1)!0.5!(PDL)$) {$4$}; 64 | 65 | % CTMRG tensors 66 | \foreach \tensor in {T1, C2} { 67 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 68 | } 69 | 70 | \end{scope} 71 | 72 | \end{tikzpicture} 73 | 74 | \end{document} 75 | %%% Local Variables: 76 | %%% mode: latex 77 | %%% TeX-master: t 78 | %%% End: 79 | -------------------------------------------------------------------------------- /docs/source/images/ctmrg_top_right_large_d.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{arrows, arrows.meta, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | \def\tensorSize{0.2} 19 | 20 | \begin{scope}[shift = {(+3, +2)}] 21 | 22 | % label 23 | \node at (+3.5,0) {\large$\rho_\text{UR}^{[x,y + 1]}$}; 24 | 25 | % network corrdinates 26 | \coordinate (PN) at (+0.0, +0.5); 27 | \coordinate (PC) at (+0.0, -0.5); 28 | \coordinate (T1) at (+1.5, +1.5); 29 | \coordinate (C2) at (+3.5, +1.5); 30 | \coordinate (T2) at (+2.0, -0.0); 31 | 32 | % external links 33 | \draw[ultra thick] (T1) to ($(T1) + (-1.50, +0.00)$) node at ($(T1) + (-2.00, +0.00)$) {$-1$}; 34 | \draw[thick] (PN) to ($(PN) + (-1.00, +0.00)$) node at ($(PN) + (-1.50, +0.00)$) {$-2$}; 35 | \draw[thick] (PC) to ($(PC) + (-2.00, +0.00)$) node at ($(PC) + (-2.50, +0.00)$) {$-3$}; 36 | \draw[ultra thick] (T2) to ($(T2) + (-1.25, -1.25)$) node at ($(T2) + (-1.50, -1.50)$) {$-4$}; 37 | \draw[thick] (PC) to ($(PC) + (-0.75, -0.75)$) node at ($(PC) + (-1.00, -1.00)$) {$-5$}; 38 | \draw[thick] (PN) to ($(PN) + (-1.75, -1.75)$) node at ($(PN) + (-2.00, -2.00)$) {$-6$}; 39 | 40 | 41 | % internal links 42 | \draw[ultra thick] (C2) to (T2) node[right = 0.25] at ($(C2)!0.5!(T2)$) {$2$}; 43 | \draw[thick] (T2) to [out = 180, in = 0] (PC) node[below] at ($(T2)!0.7!(PC)$) {$7$}; 44 | \draw[ultra thick] (C2) -- (T1) node [midway, above] {$1$}; 45 | \draw[thick] (T1) to [out = 225, in = 45] (PC) node[right] at ($(T1)!0.3!(PC)$) {$6$}; 46 | \draw[thick] (T2) to [out = 180, in = 0] (PN) node[above] at ($(T2)!0.3!(PN)$) {$5$}; 47 | \draw[thick] (T1) to [out = 225, in = 45] (PN) node[above left] at ($(T1)!0.7!(PN)$) {$4$}; 48 | \draw[thick] (PN) -- (PC) node [midway, right] {$3$}; 49 | 50 | % CTMRG tensors 51 | \foreach \tensor in {T1, C2, T2} { 52 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 53 | } 54 | 55 | % iPEPS tensors 56 | \foreach \tensor in {PN, PC} { 57 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 58 | } 59 | 60 | \end{scope} 61 | 62 | \end{tikzpicture} 63 | 64 | \end{document} 65 | 66 | %%% Local Variables: 67 | %%% mode: latex 68 | %%% TeX-master: t 69 | %%% End: 70 | -------------------------------------------------------------------------------- /docs/source/general.rst: -------------------------------------------------------------------------------- 1 | .. _general: 2 | 3 | 4 | Introduction 5 | ============ 6 | 7 | variPEPS is a Python tensor network library developed for variational ground 8 | state simulations in two spatial dimensions applying gradient optimization using 9 | automatic differentation. 10 | 11 | For a detailed report on the method, please see `our open-access publication on 12 | SciPost (doi:10.21468/SciPostPhysLectNotes.86) 13 | `_. 14 | 15 | Installation using pip 16 | ====================== 17 | 18 | The current version of the variPEPS Python package is available on `PyPI 19 | `_. It can be easily installed using the 20 | Python package manager pip: 21 | 22 | .. code-block:: console 23 | 24 | $ python3 -m pip install variPEPS 25 | 26 | Usage 27 | ===== 28 | 29 | The :obj:`varipeps` module is organized in several submodules corresponding to 30 | the different features. For a variational optimization the most important parts 31 | are (a full overview can be found in the :ref:`_api`): 32 | 33 | * :obj:`varipeps.peps`: To define iPEPS unit cell and the tensors on each site, 34 | the library provides in this submodule the abstractions to define such a unit 35 | cell. 36 | * :obj:`varipeps.expectation`: In this submodule the helper functions to define 37 | and calculate common expecation functions on the iPEPS unit 38 | cell. Particularly, the function can be used to define the Hamiltonian terms 39 | of the model of interest. 40 | * :obj:`varipeps.mapping`: If not only interactions on the square lattice are of 41 | interest but also models on other 2d lattices, in this submodule one can find 42 | mappings of other lattices. Also the files there can be a good starting point 43 | to implement even more lattices. 44 | * :obj:`varipeps.optimization`: The submodule providing the optimization 45 | algorithm and interface of the library. In almost all cases, one will interact 46 | with this part by the main function 47 | :obj:`varipeps.optimization.optimize_peps_network`. 48 | 49 | All these different modules can be seen in action in the :ref:`_examples` 50 | section of the documentation where exemplary code is discussed in detail. 51 | 52 | Citation 53 | ======== 54 | 55 | We are happy if you want to use the framework for your research. To cite our 56 | work we provide a list of our preferred references on the `GitHub page of the 57 | project 58 | `_. Please 59 | check there for a current list. 60 | -------------------------------------------------------------------------------- /varipeps/utils/periodic_indices.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | from typing import Sequence, Tuple, Union 4 | 5 | 6 | def calculate_periodic_indices( 7 | key: Tuple[Union[int, slice], Union[int, slice]], 8 | structure: Tuple[Tuple[int, ...], ...], 9 | real_ix: int, 10 | real_iy: int, 11 | ) -> Sequence[Sequence[int]]: 12 | """ 13 | Get indices according to unit cell structure. 14 | 15 | Args: 16 | key (:obj:`tuple` of 2 :obj:`int` or :obj:`slice` elements): 17 | x and y coordinates to select. Can be either integers or slices. 18 | Negative numbers as selectors are supported. 19 | structure (2d :obj:`jax.numpy.ndarray`): 20 | Two dimensional array modeling the structure of the unit cell. For 21 | details see the description of :obj:`~varipeps.peps.PEPS_Unit_Cell`. 22 | real_ix (:obj:`int`): 23 | Which real x index of structure correspond to x = 0. 24 | real_iy (:obj:`int`): 25 | Which real y index of structure correspond to y = 0. 26 | Returns: 27 | :term:`sequence` of :term:`sequence` of :obj:`int`: 28 | 2d sequence with the indices of the selected objects. 29 | """ 30 | if not isinstance(key, tuple) or not len(key) == 2: 31 | raise TypeError("Expect a tuple with coordinates x and y.") 32 | 33 | x, y = key 34 | 35 | if isinstance(x, int): 36 | x = slice(x, x + 1, None) 37 | if isinstance(y, int): 38 | y = slice(y, y + 1, None) 39 | 40 | if not isinstance(x, slice) or not isinstance(y, slice): 41 | raise TypeError("Key elements have to be integers or slices.") 42 | 43 | unit_cell_len_x = len(structure) 44 | unit_cell_len_y = len(structure[0]) 45 | 46 | if x.start is not None and x.start < 0: 47 | shift = (-x.start // unit_cell_len_x + 1) * unit_cell_len_x 48 | x = slice(x.start + shift, x.stop + shift, x.step) 49 | 50 | if x.start is None and x.stop < 0: 51 | x = slice(None, x.stop + unit_cell_len_x, x.step) 52 | 53 | if y.start is not None and y.start < 0: 54 | shift = (-y.start // unit_cell_len_y + 1) * unit_cell_len_y 55 | y = slice(y.start + shift, y.stop + shift, y.step) 56 | 57 | if y.start is None and y.stop < 0: 58 | y = slice(None, y.stop + unit_cell_len_y, y.step) 59 | 60 | xarr = np.arange( 61 | x.start or 0, x.stop if x.stop is not None else unit_cell_len_x, x.step 62 | ) 63 | yarr = np.arange( 64 | y.start or 0, y.stop if y.stop is not None else unit_cell_len_y, y.step 65 | ) 66 | 67 | xarr = (real_ix + xarr) % unit_cell_len_x 68 | yarr = (real_iy + yarr) % unit_cell_len_y 69 | 70 | return tuple(tuple(structure[xi][yi] for yi in yarr) for xi in xarr) 71 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package using Twine when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Build and upload Python Package 10 | 11 | on: 12 | workflow_dispatch: 13 | pull_request: 14 | push: 15 | branches: 16 | - main 17 | release: 18 | types: 19 | - published 20 | 21 | permissions: 22 | contents: read 23 | 24 | jobs: 25 | build_wheels: 26 | name: Build wheels for ${{ matrix.os }} 27 | runs-on: ${{ matrix.runs-on }} 28 | strategy: 29 | matrix: 30 | os: [ linux-intel, linux-arm, macos-arm, windows ] 31 | include: 32 | - archs: auto64 33 | platform: auto 34 | - os: linux-intel 35 | runs-on: ubuntu-latest 36 | - os: linux-arm 37 | runs-on: ubuntu-24.04-arm 38 | - os: windows 39 | runs-on: windows-latest 40 | - os: macos-arm 41 | # macos-14+ (including latest) are ARM64 runners 42 | runs-on: macos-latest 43 | archs: auto,universal2 44 | 45 | steps: 46 | - uses: actions/checkout@v4 47 | 48 | - name: Build wheels 49 | uses: pypa/cibuildwheel@v3.1.4 50 | env: 51 | CIBW_PLATFORM: ${{ matrix.platform }} 52 | CIBW_ARCHS: ${{ matrix.archs }} 53 | MACOSX_DEPLOYMENT_TARGET: "11.0" 54 | 55 | - uses: actions/upload-artifact@v4 56 | with: 57 | name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} 58 | path: ./wheelhouse/*.whl 59 | 60 | build_sdist: 61 | name: Build source distribution 62 | runs-on: ubuntu-latest 63 | steps: 64 | - uses: actions/checkout@v4 65 | 66 | - name: Build sdist 67 | run: pipx run build --sdist 68 | 69 | - uses: actions/upload-artifact@v4 70 | with: 71 | name: cibw-sdist 72 | path: dist/*.tar.gz 73 | 74 | publish-to-pypi: 75 | name: Publish Python distribution to PyPI 76 | if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes 77 | needs: 78 | - build_wheels 79 | - build_sdist 80 | runs-on: ubuntu-latest 81 | environment: release 82 | permissions: 83 | id-token: write # IMPORTANT: mandatory for trusted publishing 84 | steps: 85 | - name: Download the dist file 86 | uses: actions/download-artifact@v4 87 | with: 88 | pattern: cibw-* 89 | path: dist 90 | merge-multiple: true 91 | - name: Publish distribution to PyPI 92 | uses: pypa/gh-action-pypi-publish@release/v1 93 | -------------------------------------------------------------------------------- /.zenodo.json: -------------------------------------------------------------------------------- 1 | { 2 | "creators": [ 3 | { 4 | "orcid": "0000-0003-4513-5139", 5 | "affiliation": "Freie Universität Berlin", 6 | "name": "Naumann, Jan" 7 | }, 8 | { 9 | "orcid": "0000-0001-5534-6103", 10 | "affiliation": "Freie Universität Berlin", 11 | "name": "Schmoll, Philipp" 12 | }, 13 | { 14 | "orcid": "0009-0003-7734-1209", 15 | "affiliation": "Freie Universität Berlin", 16 | "name": "Losada, Roberto" 17 | }, 18 | { 19 | "orcid": "0000-0002-6224-1964", 20 | "affiliation": "Freie Universität Berlin", 21 | "name": "Wilde, Frederik" 22 | }, 23 | { 24 | "affiliation": "Freie Universität Berlin", 25 | "name": "Krein, Finn" 26 | } 27 | ], 28 | 29 | "contributors": [ 30 | { 31 | "orcid": "0009-0006-8139-8648", 32 | "affiliation": "University of Cologne", 33 | "name": "Weerda, Erik Lennart", 34 | "type": "Researcher" 35 | }, 36 | { 37 | "orcid": "0000-0002-8283-1005", 38 | "affiliation": "University of Cologne", 39 | "name": "Rizzi, Matteo", 40 | "type": "Supervisor" 41 | }, 42 | { 43 | "orcid": "0000-0003-3033-1292", 44 | "affiliation": "Freie Universität Berlin", 45 | "name": "Eisert, Jens", 46 | "type": "Supervisor" 47 | } 48 | ], 49 | 50 | "description": "A versatile tensor network library for variational ground state simulations in two spatial dimensions.", 51 | 52 | "license": "GPL-3.0-or-later", 53 | 54 | "title": "variPEPS (Python version)", 55 | 56 | "related_identifiers": [ 57 | { 58 | "identifier": "https://doi.org/10.21468/SciPostPhysLectNotes.86", 59 | "relation": "isDocumentedBy", 60 | "resource_type": "publication-article" 61 | }, 62 | { 63 | "identifier": "https://doi.org/10.1103/PhysRevB.111.235116", 64 | "relation": "isDocumentedBy", 65 | "resource_type": "publication-article" 66 | }, 67 | { 68 | "identifier": "arXiv:2510.04907", 69 | "relation": "isDocumentedBy", 70 | "resource_type": "publication-preprint" 71 | }, 72 | { 73 | "identifier": "https://varipeps.readthedocs.io/en/stable/", 74 | "relation": "isDocumentedBy", 75 | "resource_type": "publication-softwaredocumentation" 76 | } 77 | ], 78 | 79 | "keywords": [ 80 | "physics", 81 | "automatic-differentiation", 82 | "peps", 83 | "tensor-networks", 84 | "variational-optimization", 85 | "quantum-many-body", 86 | "quantum-many-body-physics" 87 | ], 88 | 89 | "communities": [ 90 | {"identifier": "crc183"} 91 | ] 92 | } 93 | -------------------------------------------------------------------------------- /varipeps/corrlength/corrlength.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from scipy.sparse.linalg import LinearOperator, eigs 3 | 4 | import jax.numpy as jnp 5 | 6 | from varipeps.contractions import apply_contraction_jitted 7 | from varipeps.peps import PEPS_Unit_Cell 8 | 9 | 10 | def calculate_correlation_length(unitcell: PEPS_Unit_Cell): 11 | initial_vector_left = apply_contraction_jitted( 12 | "corrlength_vector_left", 13 | (unitcell[0, 0][0][0].tensor,), 14 | (unitcell[0, 0][0][0],), 15 | (), 16 | ) 17 | initial_vector_left = initial_vector_left.reshape(-1) 18 | 19 | initial_vector_top = apply_contraction_jitted( 20 | "corrlength_vector_top", 21 | (unitcell[0, 0][0][0].tensor,), 22 | (unitcell[0, 0][0][0],), 23 | (), 24 | ) 25 | initial_vector_top = initial_vector_top.reshape(-1) 26 | 27 | def left_matvec(vec): 28 | vec = jnp.asarray(vec) 29 | for _, view in unitcell.iter_one_row(0): 30 | if vec.ndim != 4: 31 | vec = vec.reshape( 32 | view[0, 0][0][0].T1.shape[0], 33 | view[0, 0][0][0].tensor.shape[0], 34 | view[0, 0][0][0].tensor.shape[0], 35 | view[0, 0][0][0].T3.shape[0], 36 | ) 37 | vec = apply_contraction_jitted( 38 | "corrlength_absorb_one_column", 39 | (view[0, 0][0][0].tensor,), 40 | (view[0, 0][0][0],), 41 | (vec,), 42 | ) 43 | return vec.reshape(-1) 44 | 45 | left_lin_op = LinearOperator( 46 | (initial_vector_left.shape[0], initial_vector_left.shape[0]), 47 | matvec=left_matvec, 48 | ) 49 | 50 | eig_left, eigvec_left = eigs(left_lin_op, k=5, v0=initial_vector_left, which="LM") 51 | 52 | eig_left = eig_left[np.argsort(np.abs(eig_left))[::-1]] 53 | eig_left /= np.abs(eig_left[0]) 54 | 55 | corr_len_left = -1 / np.log(np.abs(eig_left[1])) 56 | 57 | def top_matvec(vec): 58 | vec = jnp.asarray(vec) 59 | for _, view in unitcell.iter_one_column(0): 60 | if vec.ndim != 4: 61 | vec = vec.reshape( 62 | view[0, 0][0][0].T4.shape[3], 63 | view[0, 0][0][0].tensor.shape[4], 64 | view[0, 0][0][0].tensor.shape[4], 65 | view[0, 0][0][0].T2.shape[3], 66 | ) 67 | vec = apply_contraction_jitted( 68 | "corrlength_absorb_one_row", 69 | (view[0, 0][0][0].tensor,), 70 | (view[0, 0][0][0],), 71 | (vec,), 72 | ) 73 | return vec.reshape(-1) 74 | 75 | top_lin_op = LinearOperator( 76 | (initial_vector_top.shape[0], initial_vector_top.shape[0]), 77 | matvec=top_matvec, 78 | ) 79 | 80 | eig_top, eigvec_top = eigs(top_lin_op, k=5, v0=initial_vector_top, which="LM") 81 | 82 | eig_top = eig_top[np.argsort(np.abs(eig_top))[::-1]] 83 | eig_top /= np.abs(eig_top[0]) 84 | 85 | corr_len_top = -1 / np.log(np.abs(eig_top[1])) 86 | 87 | return (corr_len_left, eig_left), (corr_len_top, eig_top) 88 | -------------------------------------------------------------------------------- /varipeps/overlap/overlap.py: -------------------------------------------------------------------------------- 1 | import jax.numpy as jnp 2 | 3 | from varipeps import varipeps_config 4 | from varipeps.ctmrg import calc_ctmrg_env, CTMRGNotConvergedError 5 | from varipeps.peps import PEPS_Unit_Cell 6 | 7 | from . import overlap_single_site 8 | from . import overlap_four_sites 9 | 10 | overlap_mapping = { 11 | (1, 1): overlap_single_site.Overlap_Single_Site, 12 | (2, 2): overlap_four_sites.Overlap_Four_Sites_Square, 13 | } 14 | 15 | 16 | def calculate_overlap( 17 | unitcell_A, unitcell_B, chi, max_chi, *, test_automatic_overlap_conv=True 18 | ): 19 | structure_A = tuple(tuple(i) for i in unitcell_A.data.structure) 20 | structure_B = tuple(tuple(i) for i in unitcell_B.data.structure) 21 | 22 | if structure_A != structure_B: 23 | raise ValueError("Structure of both unit cells have to be the same.") 24 | 25 | size = unitcell_A.get_size() 26 | num_tensors = size[0] * size[1] 27 | overlap_func = overlap_mapping[size].calc_overlap 28 | 29 | unitcell_A = unitcell_A.convert_to_full_transfer() 30 | unitcell_B = unitcell_B.convert_to_full_transfer() 31 | 32 | norm_A = overlap_func(unitcell_A) 33 | norm_B = overlap_func(unitcell_B) 34 | 35 | overlap_tensors = [ 36 | type(t).from_tensor( 37 | t.tensor / norm_A ** (1 / (2 * num_tensors)), t.d, t.D, chi, max_chi=max_chi 38 | ) 39 | for t in unitcell_A.get_unique_tensors() 40 | ] 41 | 42 | for i, e in enumerate(overlap_tensors): 43 | e.tensor_conj = unitcell_B.get_unique_tensors()[i].tensor.conj() / norm_B ** ( 44 | 1 / (2 * num_tensors) 45 | ) 46 | 47 | overlap_unitcell = PEPS_Unit_Cell.from_tensor_list(overlap_tensors, structure_A) 48 | 49 | if test_automatic_overlap_conv: 50 | tmp_max_steps = varipeps_config.ctmrg_max_steps 51 | tmp_fail = varipeps_config.ctmrg_fail_if_not_converged 52 | 53 | varipeps_config.ctmrg_fail_if_not_converged = False 54 | varipeps_config.ctmrg_max_steps = 10 55 | 56 | overlap_unitcell, _ = calc_ctmrg_env( 57 | [i.tensor for i in overlap_tensors], overlap_unitcell 58 | ) 59 | overlap_AB = overlap_func(overlap_unitcell) 60 | 61 | varipeps_config.ctmrg_max_steps = 1 62 | for count in range(tmp_max_steps): 63 | old_overlap_AB = overlap_AB 64 | 65 | overlap_unitcell, _ = calc_ctmrg_env( 66 | [i.tensor for i in overlap_tensors], overlap_unitcell 67 | ) 68 | overlap_AB = overlap_func(overlap_unitcell) 69 | 70 | if ( 71 | jnp.abs(overlap_AB - old_overlap_AB) 72 | <= varipeps_config.ctmrg_convergence_eps 73 | ): 74 | varipeps_config.ctmrg_fail_if_not_converged = tmp_fail 75 | varipeps_config.ctmrg_max_steps = tmp_max_steps 76 | break 77 | if count == (tmp_max_steps - 1): 78 | raise CTMRGNotConvergedError 79 | else: 80 | overlap_unitcell, _ = calc_ctmrg_env( 81 | [i.tensor for i in overlap_tensors], overlap_unitcell 82 | ) 83 | 84 | overlap_AB = overlap_func(overlap_unitcell) 85 | 86 | return overlap_AB 87 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_L_T4.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{LU} 39 | \begin{scope}[shift = {(+1.00, +2.00)}] 40 | \coordinate (PUL) at (-1.50, -0.50); 41 | \coordinate (PUM) at (+0.00, -0.50); 42 | \coordinate (PUR) at (+1.00, -0.50); 43 | \coordinate (PUU) at (+0.50, +0.00); 44 | \node[] at (-1.50, -0.00) {$P_\text{L(U)}^{[x - 1, y]}$}; 45 | \end{scope} 46 | 47 | % projector P_{LD} 48 | \begin{scope}[shift = {(-2.50, -2.00)}] 49 | \coordinate (PDL) at (-1.00, +0.50); 50 | \coordinate (PDM) at (+0.50, +0.50); 51 | \coordinate (PDR) at (+1.50, +0.50); 52 | \coordinate (PDD) at (-0.50, +0.00); 53 | \node[] at (-1.50, -0.00) {$P_\text{L(D)}^{[x, y]}$}; 54 | \end{scope} 55 | 56 | % tensor labels 57 | \node at (-3.0, +0) {$T_4^{[x, y]}$}; 58 | 59 | % external links 60 | \draw[thick] (PN) to ($(PN) + (+2.00, +0.00)$) node at ($(PN) + (+2.50, +0.00)$) {$-3$}; 61 | \draw[thick] (PC) to ($(PC) + (+1.00, +0.00)$) node at ($(PC) + (+1.50, +0.00)$) {$-2$}; 62 | \draw[ultra thick] (PDD) to ($(PDD) + (-1.00, -1.00)$) node at ($(PDD) + (-1.25, -1.25)$) {$-1$}; 63 | \draw[ultra thick] (PUU) to ($(PUU) + (+1.00, +1.00)$) node at ($(PUU) + (+1.25, +1.25)$) {$-4$}; 64 | 65 | % projectors 66 | \draw[thick, fill = gray!25] (PUL) to (PUR) to (PUU) -- cycle; 67 | \draw[thick, fill = gray!25] (PDL) to (PDR) to (PDD) -- cycle; 68 | 69 | % internal links 70 | \draw[ultra thick] (T4) -- (PDL) node[left = 0.25] at ($(T4)!0.5!(PDL)$) {$7$}; 71 | \draw[ultra thick] (T4) -- (PUL) node[left = 0.25] at ($(T4)!0.5!(PUL)$) {$1$}; 72 | \draw[thick] (PN) to [out = 225, in = 45] (PDM) node[left = 0.25] at ($(PN)!0.7!(PDM)$) {$8$}; 73 | \draw[thick] (PUM) to [out = 225, in = 45] (PN) node[left = 0.25] at ($(PUM)!0.3!(PN)$) {$2$}; 74 | \draw[thick] (PC) to [out = 225, in = 45] (PDR) node[right] at ($(PC)!0.7!(PDR)$) {$9$}; 75 | \draw[thick] (PUR) to [out = 225, in = 45] (PC) node[right] at ($(PUR)!0.3!(PC)$) {$5$}; 76 | \draw[thick] (T4) to [out = 0, in = 180] (PC) node[below] at ($(T4)!0.3!(PC)$) {$4$}; 77 | \draw[thick] (T4) to [out = 0, in = 180] (PN) node[above] at ($(T4)!0.7!(PN)$) {$3$}; 78 | \draw[thick] (PN) -- (PC) node [midway, right] {$6$}; 79 | 80 | % CTMRG tensors 81 | \foreach \tensor in {T4} { 82 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 83 | } 84 | 85 | % iPEPS tensors 86 | \foreach \tensor in {PN, PC} { 87 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 88 | } 89 | 90 | \end{scope} 91 | 92 | \end{tikzpicture} 93 | 94 | \end{document} 95 | %%% Local Variables: 96 | %%% mode: latex 97 | %%% TeX-master: t 98 | %%% End: 99 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_R_T2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{RU} 39 | \begin{scope}[shift = {(+2.50, +2.00)}] 40 | \coordinate (PUL) at (-1.50, -0.50); 41 | \coordinate (PUM) at (-0.50, -0.50); 42 | \coordinate (PUR) at (+1.00, -0.50); 43 | \coordinate (PUU) at (+0.50, +0.00); 44 | \node[] at (-1.50, -0.00) {$P_\text{R(U)}^{[x - 1, y]}$}; 45 | \end{scope} 46 | 47 | % projector P_{RD} 48 | \begin{scope}[shift = {(-1.00, -2.00)}] 49 | \coordinate (PDL) at (-1.00, +0.50); 50 | \coordinate (PDM) at (+0.00, +0.50); 51 | \coordinate (PDR) at (+1.50, +0.50); 52 | \coordinate (PDD) at (-0.50, +0.00); 53 | \node[] at (-1.50, -0.00) {$P_\text{R(D)}^{[x, y]}$}; 54 | \end{scope} 55 | 56 | % tensor labels 57 | \node at (+3.0, +0) {$T_{2}^{[x, y]}$}; 58 | 59 | % external links 60 | \draw[thick] (PN) to ($(PN) + (-1.00, +0.00)$) node at ($(PN) + (-1.50, +0.00)$) {$-1$}; 61 | \draw[thick] (PC) to ($(PC) + (-2.00, +0.00)$) node at ($(PC) + (-2.50, +0.00)$) {$-2$}; 62 | \draw[ultra thick] (PDD) to ($(PDD) + (-1.00, -1.00)$) node at ($(PDD) + (-1.25, -1.25)$) {$-3$}; 63 | \draw[ultra thick] (PUU) to ($(PUU) + (+1.00, +1.00)$) node at ($(PUU) + (+1.25, +1.25)$) {$-4$}; 64 | 65 | % projectors 66 | \draw[thick, fill = gray!25] (PUL) to (PUR) to (PUU) -- cycle; 67 | \draw[thick, fill = gray!25] (PDL) to (PDR) to (PDD) -- cycle; 68 | 69 | % internal links 70 | \draw[ultra thick] (T2) -- (PDR) node[right = 0.25] at ($(T2)!0.5!(PDR)$) {$7$}; 71 | \draw[ultra thick] (T2) -- (PUR) node[right = 0.25] at ($(T2)!0.5!(PUR)$) {$1$}; 72 | \draw[thick] (PN) to [out = 225, in = 45] (PDL) node[left = 0.25] at ($(PN)!0.7!(PDL)$) {$8$}; 73 | \draw[thick] (PUL) to [out = 225, in = 45] (PN) node[left = 0.25] at ($(PUL)!0.3!(PN)$) {$2$}; 74 | \draw[thick] (PC) to [out = 225, in = 45] (PDM) node[right] at ($(PC)!0.7!(PDM)$) {$9$}; 75 | \draw[thick] (PUM) to [out = 225, in = 45] (PC) node[right] at ($(PUM)!0.3!(PC)$) {$4$}; 76 | \draw[thick] (T2) to [out = 180, in = 0] (PC) node[below] at ($(T2)!0.3!(PC)$) {$5$}; 77 | \draw[thick] (T2) to [out =180, in = 0] (PN) node[above] at ($(T2)!0.7!(PN)$) {$3$}; 78 | \draw[thick] (PN) -- (PC) node [midway, right] {$6$}; 79 | 80 | % CTMRG tensors 81 | \foreach \tensor in {T2} { 82 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 83 | } 84 | 85 | % iPEPS tensors 86 | \foreach \tensor in {PN, PC} { 87 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 88 | } 89 | 90 | \end{scope} 91 | 92 | \end{tikzpicture} 93 | 94 | \end{document} 95 | %%% Local Variables: 96 | %%% mode: latex 97 | %%% TeX-master: t 98 | %%% End: 99 | -------------------------------------------------------------------------------- /varipeps/overlap/overlap_four_sites.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import jax.numpy as jnp 3 | 4 | from jax import jit 5 | 6 | from varipeps.contractions import apply_contraction_jitted 7 | 8 | 9 | class Overlap_Four_Sites_Square: 10 | @staticmethod 11 | @jit 12 | def calc_overlap(unitcell): 13 | top_left = apply_contraction_jitted( 14 | "ctmrg_top_left", [unitcell[0, 0][0][0].tensor], [unitcell[0, 0][0][0]], [] 15 | ) 16 | top_left = top_left.reshape( 17 | np.prod(top_left.shape[:3]), np.prod(top_left.shape[3:]) 18 | ) 19 | 20 | top_right = apply_contraction_jitted( 21 | "ctmrg_top_right", [unitcell[0, 1][0][0].tensor], [unitcell[0, 1][0][0]], [] 22 | ) 23 | top_right = top_right.reshape( 24 | np.prod(top_right.shape[:3]), np.prod(top_right.shape[3:]) 25 | ) 26 | 27 | bottom_left = apply_contraction_jitted( 28 | "ctmrg_bottom_left", 29 | [unitcell[1, 0][0][0].tensor], 30 | [unitcell[1, 0][0][0]], 31 | [], 32 | ) 33 | bottom_left = bottom_left.reshape( 34 | np.prod(bottom_left.shape[:3]), np.prod(bottom_left.shape[3:]) 35 | ) 36 | 37 | bottom_right = apply_contraction_jitted( 38 | "ctmrg_bottom_right", 39 | [unitcell[1, 1][0][0].tensor], 40 | [unitcell[1, 1][0][0]], 41 | [], 42 | ) 43 | bottom_right = bottom_right.reshape( 44 | np.prod(bottom_right.shape[:3]), np.prod(bottom_right.shape[3:]) 45 | ) 46 | 47 | norm_with_sites = jnp.trace(top_left @ top_right @ bottom_left @ bottom_right) 48 | 49 | norm_corners = apply_contraction_jitted( 50 | "overlap_four_sites_square_only_corners", 51 | [ 52 | unitcell[0, 0][0][0].tensor, 53 | unitcell[0, 1][0][0].tensor, 54 | unitcell[1, 1][0][0].tensor, 55 | unitcell[1, 0][0][0].tensor, 56 | ], 57 | [ 58 | unitcell[0, 0][0][0], 59 | unitcell[0, 1][0][0], 60 | unitcell[1, 1][0][0], 61 | unitcell[1, 0][0][0], 62 | ], 63 | [], 64 | ) 65 | 66 | norm_horizontal = apply_contraction_jitted( 67 | "overlap_four_sites_square_transfer_horizontal", 68 | [ 69 | unitcell[0, 0][0][0].tensor, 70 | unitcell[0, 1][0][0].tensor, 71 | unitcell[1, 1][0][0].tensor, 72 | unitcell[1, 0][0][0].tensor, 73 | ], 74 | [ 75 | unitcell[0, 0][0][0], 76 | unitcell[0, 1][0][0], 77 | unitcell[1, 1][0][0], 78 | unitcell[1, 0][0][0], 79 | ], 80 | [], 81 | ) 82 | 83 | norm_vertical = apply_contraction_jitted( 84 | "overlap_four_sites_square_transfer_vertical", 85 | [ 86 | unitcell[0, 0][0][0].tensor, 87 | unitcell[0, 1][0][0].tensor, 88 | unitcell[1, 1][0][0].tensor, 89 | unitcell[1, 0][0][0].tensor, 90 | ], 91 | [ 92 | unitcell[0, 0][0][0], 93 | unitcell[0, 1][0][0], 94 | unitcell[1, 1][0][0], 95 | unitcell[1, 0][0][0], 96 | ], 97 | [], 98 | ) 99 | 100 | return (norm_with_sites * norm_corners) / (norm_horizontal * norm_vertical) 101 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_D_T3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope} 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{UL} 39 | \begin{scope}[shift = {(-3.50, -0.50)}] 40 | \coordinate (PLL) at (+0.00, +0.00); 41 | \coordinate (PLU) at (+2.00, +1.00); 42 | \coordinate (PLM) at (+1.00, +0.00); 43 | \coordinate (PLD) at (+0.00, -1.00); 44 | \node[] at (+0.00, +1.00) {$P_\text{D(L)}^{[x, y - 1]}$}; 45 | \end{scope} 46 | 47 | % projector P_{UR} 48 | \begin{scope}[shift = {(+2.50, -0.50)}] 49 | \coordinate (PRU) at (+0.00, +1.00); 50 | \coordinate (PRM) at (-1.00, -0.00); 51 | \coordinate (PRD) at (-2.00, -1.00); 52 | \coordinate (PRR) at (+0.00, +0.00); 53 | \node[] at (-0.00, -1.00) {$P_\text{D(R)}^{[x, y]}$}; 54 | \end{scope} 55 | 56 | % tensor labels 57 | \node at ($(T3) + (-0.75, -0.75)$) {$T_{3}^{[x, y]}$}; 58 | 59 | % external links 60 | \draw[thick] (PN) to ($(PN) + (+1.50, +1.50)$) node at ($(PN) + (+2.00, +2.00)$) {$-4$}; 61 | \draw[thick] (PC) to ($(PC) + (+1.50, +1.50)$) node at ($(PC) + (+2.00, +2.00)$) {$-3$}; 62 | \draw[ultra thick] (PLL) to ($(PLL) + (-1.50, -0.00)$) node at ($(PLL) + (-2.00, -0.00)$) {$-1$}; 63 | \draw[ultra thick] (PRR) to ($(PRR) + (+1.50, +0.00)$) node at ($(PRR) + (+2.00, +0.00)$) {$-2$}; 64 | 65 | % projectors 66 | \draw[thick, fill = gray!25] (PLL) to (PLU) to (PLD) -- cycle; 67 | \draw[thick, fill = gray!25] (PRR) to (PRU) to (PRD) -- cycle; 68 | 69 | % internal links 70 | \draw[ultra thick] (T3) -- (PLD) node[below] at ($(T3)!0.5!(PLD)$) {$1$}; 71 | \draw[ultra thick] (T3) -- (PRD) node[below] at ($(T3)!0.5!(PRD)$) {$7$}; 72 | \draw[thick] (PN) to [out = 180, in = 0] (PLU) node[below] at ($(PN)!0.7!(PLU)$) {$3$}; 73 | \draw[thick] (PRU) to [out = 180, in = 0] (PN) node[below] at ($(PRU)!0.3!(PN)$) {$8$}; 74 | \draw[thick] (PC) to [out = 180, in = 0] (PLM) node[below] at ($(PC)!0.7!(PLM)$) {$5$}; 75 | \draw[thick] (PRM) to [out = 180, in = 0] (PC) node[below] at ($(PRM)!0.5!(PC)$) {$9$}; 76 | \draw[thick] (T3) to [out = 45, in = 225] (PC) node[right = 0.1] at ($(T3)!0.3!(PC)$) {$4$}; 77 | \draw[thick] (T3) to [out = 45, in = 225] (PN) node[left = 0.1] at ($(T3)!0.3!(PN)$) {$2$}; 78 | \draw[thick] (PN) -- (PC) node [midway, right] {$6$}; 79 | 80 | % CTMRG tensors 81 | \foreach \tensor in {T3} { 82 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 83 | } 84 | 85 | % iPEPS tensors 86 | \foreach \tensor in {PN, PC} { 87 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 88 | } 89 | 90 | \end{scope} 91 | 92 | \end{tikzpicture} 93 | 94 | \end{document} 95 | 96 | %%% Local Variables: 97 | %%% mode: latex 98 | %%% TeX-master: t 99 | %%% End: 100 | -------------------------------------------------------------------------------- /docs/source/images/CTMRG_Absorption_U_T1.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \begin{tikzpicture}[] 17 | 18 | % contant definitions 19 | \def\tensorSize{0.2} 20 | 21 | % tensor network contraction 22 | \begin{scope}[shift = {(+2.0, -0.5)}] 23 | 24 | % iPEPS network coordinates 25 | \coordinate (PN) at (+0.0, +0.5); 26 | \coordinate (PC) at (+0.0, -0.5); 27 | 28 | % CTMRG network coordinates 29 | \coordinate (C1) at (-0.5, +1.5); 30 | \coordinate (T1) at (+1.5, +1.5); 31 | \coordinate (C2) at (+3.5, +1.5); 32 | \coordinate (T2) at (+2.0, +0.0); 33 | \coordinate (C3) at (+0.5, -1.5); 34 | \coordinate (T3) at (-1.5, -1.5); 35 | \coordinate (C4) at (-3.5, -1.5); 36 | \coordinate (T4) at (-2.0, -0.0); 37 | 38 | % projector P_{UL} 39 | \begin{scope}[shift = {(-2.50, +0.50)}] 40 | \coordinate (PLL) at (+0.00, +0.00); 41 | \coordinate (PLU) at (+2.00, +1.00); 42 | \coordinate (PLM) at (+1.00, +0.00); 43 | \coordinate (PLD) at (+0.00, -1.00); 44 | \node[] at (+0.00, +1.00) {$\rho_\text{U(L)}^{[x, y - 1]}$}; 45 | \end{scope} 46 | 47 | % projector P_{UR} 48 | \begin{scope}[shift = {(+3.50, +0.50)}] 49 | \coordinate (PRU) at (+0.00, +1.00); 50 | \coordinate (PRM) at (-1.00, -0.00); 51 | \coordinate (PRD) at (-2.00, -1.00); 52 | \coordinate (PRR) at (+0.00, +0.00); 53 | \node[] at (-0.00, -1.00) {$\rho_\text{U(R)}^{[x, y]}$}; 54 | \end{scope} 55 | 56 | % tensor labels 57 | \node at ($(T1) + (+0.75, +0.75)$) {$T_1^{[x, y]}$}; 58 | 59 | % external links 60 | \draw[thick] (PN) to ($(PN) + (-1.50, -1.50)$) node at ($(PN) + (-2.00, -2.00)$) {$-2$}; 61 | \draw[thick] (PC) to ($(PC) + (-1.50, -1.50)$) node at ($(PC) + (-2.00, -2.00)$) {$-3$}; 62 | \draw[ultra thick] (PLL) to ($(PLL) + (-1.50, -0.00)$) node at ($(PLL) + (-2.00, -0.00)$) {$-1$}; 63 | \draw[ultra thick] (PRR) to ($(PRR) + (+1.50, +0.00)$) node at ($(PRR) + (+2.00, +0.00)$) {$-4$}; 64 | 65 | % projectors 66 | \draw[thick, fill = gray!25] (PLL) to (PLU) to (PLD) -- cycle; 67 | \draw[thick, fill = gray!25] (PRR) to (PRU) to (PRD) -- cycle; 68 | 69 | % internal links 70 | \draw[ultra thick] (T1) -- (PLU) node[above] at ($(T1)!0.5!(PLU)$) {$1$}; 71 | \draw[ultra thick] (T1) -- (PRU) node[above] at ($(T1)!0.5!(PRU)$) {$7$}; 72 | \draw[thick] (PN) to [out = 180, in = 0] (PLM) node[above] at ($(PN)!0.5!(PLM)$) {$3$}; 73 | \draw[thick] (PRM) to [out = 180, in = 0] (PN) node[above] at ($(PRM)!0.3!(PN)$) {$8$}; 74 | \draw[thick] (PC) to [out = 180, in = 0] (PLD) node[above] at ($(PC)!0.7!(PLD)$) {$5$}; 75 | \draw[thick] (PRD) to [out = 180, in = 0] (PC) node[above] at ($(PRD)!0.5!(PC)$) {$9$}; 76 | \draw[thick] (T1) to [out = 225, in = 45] (PC) node[right] at ($(T1)!0.3!(PC)$) {$4$}; 77 | \draw[thick] (T1) to [out = 225, in = 45] (PN) node[above] at ($(T1)!0.7!(PN)$) {$2$}; 78 | \draw[thick] (PN) -- (PC) node [midway, right] {$6$}; 79 | 80 | % CTMRG tensors 81 | \foreach \tensor in {T1} { 82 | \draw[thick,black,fill = gray] (\tensor) circle (\tensorSize); 83 | } 84 | 85 | % iPEPS tensors 86 | \foreach \tensor in {PN, PC} { 87 | \draw[thick,black,fill = blue] (\tensor) circle (\tensorSize); 88 | } 89 | 90 | \end{scope} 91 | 92 | \end{tikzpicture} 93 | 94 | \end{document} 95 | 96 | %%% Local Variables: 97 | %%% mode: latex 98 | %%% TeX-master: t 99 | %%% End: 100 | -------------------------------------------------------------------------------- /docs/source/images/triangular_structure.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{shapes.geometric,patterns,positioning,matrix} 9 | \usetikzlibrary{shadows,calc,3d,arrows.meta,decorations.pathmorphing,decorations.markings,decorations.pathreplacing} 10 | 11 | \definecolor{googleB}{HTML}{4285F4} 12 | \definecolor{googleG}{HTML}{34A853} 13 | \definecolor{googleY}{HTML}{FBBC05} 14 | \definecolor{googleR}{HTML}{EA4335} 15 | \definecolor{googleBG}{HTML}{3B96A4} 16 | 17 | % load TikZ grafic definitions 18 | %\input{gfx_TikZ} 19 | 20 | % main document 21 | \begin{document} 22 | 23 | \begin{tikzpicture} 24 | 25 | \def\clipX{2.00} 26 | \def\clipY{1.75} 27 | \def\legLength{0.2} 28 | \def\tensorSize{0.125} 29 | \def\tensorSizeS{0.15} 30 | 31 | \begin{scope}[shift = {({3*cos(30)}, +5.25)}] 32 | \draw[thick, -{Stealth[scale = 1.0]}] (0 : 0) to (270 : 1.0) node at (270 : 1.25) {$x$}; 33 | \draw[thick, -{Stealth[scale = 1.0]}] (0 : 0) to ( 30 : 1.0) node at ( 30 : 1.25) {$y$}; 34 | \end{scope} 35 | 36 | % \begin{scope}[shift = {(-4.25,{0.5*cos(30)*tan(60)/2}) to (+2,{1*cos(30)*tan(60)/2})}] 37 | \begin{scope}[] 38 | 39 | \foreach \x/\y in {+3/-2, +6/0, +3/+2, +9/+2, +6/+4, +9/+6} { 40 | \begin{scope}[shift = {({\x*cos(30)}, {\y*cos(30)*tan(60)/2}, 0)}] 41 | 42 | % virtual links triangular lattice 43 | \coordinate (A) at (0, 0 , 0); 44 | \coordinate (B) at ({2.0*cos(30)*cos(0)}, {2.0*cos(30)*sin(0)}, 0); 45 | \coordinate (C) at ({2.0*cos(30)*cos(60)}, {2.0*cos(30)*sin(60)}, 0); 46 | 47 | \draw[gray, shift = {(A)}] ({-0.5*cos(30)},{-1.0*cos(30)*tan(60)/2},0) to ({+0.5*cos(30)},{+1.0*cos(30)*tan(60)/2},0); 48 | \draw[gray, shift = {(A)}] ({-0.5*cos(30)},{+1.0*cos(30)*tan(60)/2},0) to ({+0.5*cos(30)},{-1.0*cos(30)*tan(60)/2},0); 49 | \draw[gray, shift = {(A)}] ({-1.0*cos(30)}, 0, 0) to ({+1.0*cos(30)}, 0, 0); 50 | 51 | \draw[gray, shift = {(B)}] ({-0.5*cos(30)},{-1.0*cos(30)*tan(60)/2},0) to ({+0.5*cos(30)},{+1.0*cos(30)*tan(60)/2},0); 52 | \draw[gray, shift = {(B)}] ({-0.5*cos(30)},{+1.0*cos(30)*tan(60)/2},0) to ({+0.5*cos(30)},{-1.0*cos(30)*tan(60)/2},0); 53 | \draw[gray, shift = {(B)}] ({-1.0*cos(30)}, 0, 0) to ({+1.0*cos(30)}, 0, 0); 54 | 55 | \draw[gray, shift = {(C)}] ({-0.5*cos(30)},{-1.0*cos(30)*tan(60)/2},0) to ({+0.5*cos(30)},{+1.0*cos(30)*tan(60)/2},0); 56 | \draw[gray, shift = {(C)}] ({-0.5*cos(30)},{+1.0*cos(30)*tan(60)/2},0) to ({+0.5*cos(30)},{-1.0*cos(30)*tan(60)/2},0); 57 | \draw[gray, shift = {(C)}] ({-1.0*cos(30)}, 0, 0) to ({+1.0*cos(30)}, 0, 0); 58 | 59 | % lattice site 60 | \draw[black, fill = white] (A) circle (\tensorSize); 61 | \draw[black, fill = white] (B) circle (\tensorSize); 62 | \draw[black, fill = white] (C) circle (\tensorSize); 63 | 64 | % draw coarse-grained tensor 65 | \coordinate (D) at ({1.0*cos(30)}, {1.0*sin(30)}, 0); 66 | \draw[thick] (D) to ($(D) + ({+1.5*cos(30)}, {+1.0*cos(30)*tan(60)/2}, 0)$); 67 | \draw[thick] (D) to ($(D) + ({-1.5*cos(30)}, {-1.0*cos(30)*tan(60)/2}, 0)$); 68 | \draw[thick] (D) to ($(D) + ({0}, {+2.0*cos(30)*tan(60)/2}, 0)$); 69 | \draw[thick] (D) to ($(D) + ({0}, {-2.0*cos(30)*tan(60)/2}, 0)$); 70 | \draw[thick, fill = googleB] (D) circle (\tensorSizeS); 71 | 72 | % draw unit cell boarders 73 | \draw[very thick, gray, dotted, rounded corners = 5] ($(A) + (180 : 0.25)$) to ($(A) + (240 : 0.25)$) to ($(A) + (300 : 0.25)$) to ($(B) + (300 : 0.25)$) to ($(B) + ( 0 : 0.25)$) to ($(B) + ( 60 : 0.25)$) to ($(C) + ( 0 : 0.25)$) to ($(C) + ( 60 : 0.25)$) to ($(C) + (120 : 0.25)$) -- cycle; 74 | 75 | \end{scope} 76 | } 77 | 78 | \end{scope} 79 | 80 | \end{tikzpicture} 81 | 82 | \end{document} 83 | 84 | %%% Local Variables: 85 | %%% mode: latex 86 | %%% TeX-master: t 87 | %%% End: 88 | -------------------------------------------------------------------------------- /varipeps/expectation/spiral_helpers.py: -------------------------------------------------------------------------------- 1 | from functools import partial 2 | 3 | from varipeps.config import Wavevector_Type 4 | import jax.numpy as jnp 5 | import jax.scipy as jsp 6 | from jax import jit 7 | 8 | from typing import Sequence, Union 9 | 10 | 11 | @partial(jit, static_argnums=(5, 6, 7, 8)) 12 | def apply_unitary( 13 | gate: jnp.ndarray, 14 | delta_r: jnp.ndarray, 15 | q: Sequence[jnp.ndarray], 16 | unitary_operator_D: jnp.ndarray, 17 | unitary_operator_sigma: jnp.ndarray, 18 | phys_d: int, 19 | number_sites: int, 20 | apply_to_index: Sequence[int], 21 | wavevector_type: Wavevector_Type, 22 | ) -> jnp.ndarray: 23 | """ 24 | Apply the unitary of the spiral iPEPS approach to a gate. The function 25 | calculates the relative unitary gate from the operator, the spatial 26 | difference and the wavevector. 27 | 28 | Args: 29 | gate (:obj:`jax.numpy.ndarray`): 30 | The gate which should be updated with the unitary operator. 31 | delta_r (:obj:`jax.numpy.ndarray`): 32 | Vector for the spatial difference. Can be a sequence if the spatial 33 | difference are different for the single indices. 34 | q (:term:`sequence` of :obj:`jax.numpy.ndarray`): 35 | Sequence with the relevant wavevector for the different indices of 36 | the gate. 37 | unitary_operator_D (:obj:`jax.numpy.ndarray`): 38 | Array with the eigenvalues of the operator from which the unitary 39 | is generated. 40 | unitary_operator_sigma (:obj:`jax.numpy.ndarray`): 41 | Array with the eigenvectors of the operator from which the unitary 42 | is generated. 43 | phys_d (:obj:`int`): 44 | Physical dimension of the indices of the gate. 45 | number_sites (:obj:`int`): 46 | Number of sites the gate is applied to. 47 | apply_to_index (:term:`sequence` of :obj:`int`): 48 | The indices of the gate which should be modified by the unitary 49 | generated to the same ordered sequence of wavevectors. 50 | wavevector_type (:obj:`~varipeps.config.Wavevector_Type`): 51 | Type of the wavevector (see type definition for details). 52 | Returns: 53 | :obj:`jax.numpy.ndarray`: 54 | The updated gate with the unitary applied. 55 | """ 56 | if isinstance(delta_r, jnp.ndarray): 57 | delta_r = (delta_r,) * len(apply_to_index) 58 | 59 | if isinstance(q, jnp.ndarray): 60 | q = (q,) * len(apply_to_index) 61 | 62 | if len(q) != len(apply_to_index) or len(q) != len(delta_r): 63 | raise ValueError("Length mismatch!") 64 | 65 | working_gate = gate.reshape((phys_d,) * 2 * number_sites) 66 | 67 | for index, i in enumerate(apply_to_index): 68 | w_q = q[index] 69 | w_r = delta_r[index] 70 | 71 | if w_q.ndim == 0: 72 | w_q = jnp.array((w_q, w_q)) 73 | elif w_q.size == 1: 74 | w_q = jnp.array((w_q[0], w_q[0])) 75 | 76 | if wavevector_type is Wavevector_Type.TWO_PI_POSITIVE_ONLY: 77 | w_q = w_q % 2 78 | elif wavevector_type is Wavevector_Type.TWO_PI_SYMMETRIC: 79 | w_q = w_q % 4 - 2 80 | else: 81 | raise ValueError("Unknown wavevector type!") 82 | 83 | # U = jsp.linalg.expm(1j * jnp.pi * jnp.dot(w_q, w_r) * unitary_operator) 84 | U = jnp.exp(1j * jnp.pi * jnp.dot(w_q, w_r) * unitary_operator_D) 85 | U = jnp.dot( 86 | unitary_operator_sigma * U[jnp.newaxis, :], unitary_operator_sigma.T.conj() 87 | ) 88 | 89 | working_gate = jnp.tensordot(U, working_gate, ((1,), (i,))) 90 | working_gate = jnp.tensordot( 91 | U.conj(), working_gate, ((1,), (number_sites + i,)) 92 | ) 93 | 94 | new_i_list = list(range(2, 2 * number_sites)) 95 | new_i_list.insert(i, 1) 96 | new_i_list.insert(number_sites + i, 0) 97 | 98 | working_gate = working_gate.transpose(new_i_list) 99 | 100 | working_gate = working_gate.reshape(phys_d**number_sites, phys_d**number_sites) 101 | 102 | return working_gate 103 | -------------------------------------------------------------------------------- /docs/source/images/kagome_structure.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{shapes.geometric,patterns,positioning,matrix} 9 | \usetikzlibrary{shadows,calc,3d,arrows.meta,decorations.pathmorphing,decorations.markings,decorations.pathreplacing} 10 | 11 | \definecolor{googleB}{HTML}{4285F4} 12 | \definecolor{googleG}{HTML}{34A853} 13 | \definecolor{googleY}{HTML}{FBBC05} 14 | \definecolor{googleR}{HTML}{EA4335} 15 | \definecolor{googleBG}{HTML}{3B96A4} 16 | 17 | % load TikZ grafic definitions 18 | %\input{gfx_TikZ} 19 | 20 | % main document 21 | \begin{document} 22 | 23 | \begin{tikzpicture} 24 | 25 | \def\disT{0.750} 26 | \def\tensorSize{0.125} 27 | 28 | % \begin{scope}[shift = {(-4.5, +3.25)}] 29 | % \draw[thick, -{Stealth[scale = 1.0]}] (0 : 0) to (240 : 1.0) node at (240 : 1.25) {$x$}; 30 | % \draw[thick, -{Stealth[scale = 1.0]}] (0 : 0) to ( 0 : 1.0) node at ( 0 : 1.25) {$y$}; 31 | % \end{scope} 32 | 33 | \foreach \x in {-6, -2, +2} { 34 | 35 | \foreach \y in {0} { 36 | 37 | \begin{scope}[shift = {({\x*\disT*cos(30)}, \y*\disT)}] 38 | 39 | \coordinate (T1) at (210 : \disT); 40 | \coordinate (T2) at ( 90 : \disT); 41 | \coordinate (T3) at (330 : \disT); 42 | 43 | % draw inter-layer T1-T2-T3 44 | \draw[thick] (T1) to (T2) to (T3) -- cycle; 45 | \draw[thick] (T1) to ($(T1) + (180 : {1.0 * cos(30) * \disT})$); 46 | \draw[thick] (T1) to ($(T1) + (240 : {1.0 * cos(30) * \disT})$); 47 | \draw[thick] (T2) to ($(T2) + ( 60 : {1.0 * cos(30) * \disT})$); 48 | \draw[thick] (T2) to ($(T2) + (120 : {1.0 * cos(30) * \disT})$); 49 | \draw[thick] (T3) to ($(T3) + ( 0 : {1.0 * cos(30) * \disT})$); 50 | \draw[thick] (T3) to ($(T3) + (300 : {1.0 * cos(30) * \disT})$); 51 | 52 | \foreach \T in {T1, T2, T3} { 53 | \draw[thick, fill = white] (\T) circle (\tensorSize); 54 | } 55 | 56 | % draw unit cell borders 57 | \draw[thick, gray, dotted, rounded corners] ($(T2) + (90 : 0.50)$) to ($(T1) + (210 : 0.50)$) to ($(T3) + (330 : 0.50)$) -- cycle; 58 | 59 | \end{scope} 60 | 61 | } 62 | 63 | } 64 | 65 | \foreach \x in {-4, 0, +4} { 66 | 67 | \foreach \y in {+4.0} { 68 | 69 | \begin{scope}[shift = {({\x*\disT*cos(30)}, {\y*\disT*cos(30)*tan(60)/2})}] 70 | 71 | \coordinate (T1) at (210 : \disT); 72 | \coordinate (T2) at ( 90 : \disT); 73 | \coordinate (T3) at (330 : \disT); 74 | 75 | % draw inter-layer T1-T2-T3 76 | \draw[thick] (T1) to (T2) to (T3) -- cycle; 77 | \draw[thick] (T1) to ($(T1) + (180 : {1.0 * cos(30) * \disT})$); 78 | \draw[thick] (T1) to ($(T1) + (240 : {1.0 * cos(30) * \disT})$); 79 | \draw[thick] (T2) to ($(T2) + ( 60 : {1.0 * cos(30) * \disT})$); 80 | \draw[thick] (T2) to ($(T2) + (120 : {1.0 * cos(30) * \disT})$); 81 | \draw[thick] (T3) to ($(T3) + ( 0 : {1.0 * cos(30) * \disT})$); 82 | \draw[thick] (T3) to ($(T3) + (300 : {1.0 * cos(30) * \disT})$); 83 | 84 | \foreach \T in {T1, T2, T3} { 85 | \draw[thick, fill = white] (\T) circle (\tensorSize); 86 | } 87 | 88 | % draw unit cell borders 89 | \draw[thick, gray, dotted, rounded corners] ($(T2) + (90 : 0.50)$) to ($(T1) + (210 : 0.50)$) to ($(T3) + (330 : 0.50)$) -- cycle; 90 | 91 | \end{scope} 92 | 93 | } 94 | 95 | } 96 | 97 | \end{tikzpicture} 98 | 99 | \end{document} 100 | 101 | %%% Local Variables: 102 | %%% mode: latex 103 | %%% TeX-master: t 104 | %%% End: 105 | -------------------------------------------------------------------------------- /docs/source/images/square_kagome_structure.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{shapes.geometric,patterns,positioning,matrix} 9 | \usetikzlibrary{shadows,calc,3d,arrows.meta,decorations.pathmorphing,decorations.markings,decorations.pathreplacing} 10 | 11 | \definecolor{googleB}{HTML}{4285F4} 12 | \definecolor{googleG}{HTML}{34A853} 13 | \definecolor{googleY}{HTML}{FBBC05} 14 | \definecolor{googleR}{HTML}{EA4335} 15 | \definecolor{googleBG}{HTML}{3B96A4} 16 | 17 | % load TikZ grafic definitions 18 | %\input{gfx_TikZ} 19 | 20 | % main document 21 | \begin{document} 22 | 23 | \begin{tikzpicture} 24 | 25 | \def\disL{0.75} 26 | \def\tensorSizeL{0.125} 27 | \def\tensorSizeS{0.150} 28 | 29 | \begin{scope}[shift = {(-0.5, +0.5)}] 30 | \draw[thick, -{Stealth[scale = 1.0]}] (0, 0) to (0, -1.25) node at (0, -1.50) {$x$}; 31 | \draw[thick, -{Stealth[scale = 1.0]}] (0, 0) to (+1.25, 0) node at (+1.50, 0) {$y$}; 32 | \end{scope} 33 | 34 | \foreach \x in {-1, +1, +3} { 35 | 36 | \foreach \y in {-1, +1} { 37 | 38 | \begin{scope}[shift = {({\x * \disL + \x * tan(60) * \disL}, {\y * \disL + \y * tan(60) * \disL})}] 39 | 40 | % define Square-Kagome lattice coordiates 41 | % \coordinate (1) at ($(0, {-\disL - tan(30) * \disL}) + (270 : {\disL / cos(30)})$); 42 | \coordinate (1) at (0, {- \disL - \disL / tan(30)}); 43 | \coordinate (2) at (-\disL, -\disL); 44 | \coordinate (3) at (-\disL, +\disL); 45 | \coordinate (4) at (+\disL, -\disL); 46 | \coordinate (5) at (+\disL, +\disL); 47 | % \coordinate (6) at ($({+\disL + tan(30) * \disL}, 0) + ( 0 : {\disL / cos(30)})$); 48 | \coordinate (6) at ({+\disL + \disL / tan(30)}, 0); 49 | 50 | % define iPESS coordinates 51 | \coordinate (SL) at ({-\disL - tan(30) * \disL}, 0); 52 | \coordinate (SU) at (0, {+\disL + tan(30) * \disL}); 53 | \coordinate (SR) at ({+\disL + tan(30) * \disL}, 0); 54 | \coordinate (SD) at (0, {-\disL - tan(30) * \disL}); 55 | 56 | % Square-Kagome lattice links 57 | \draw[gray] (2) to (3) to (5) to (4) -- cycle; 58 | 59 | \draw[gray] (1) to ($(1) + ( 60 : \disL)$); 60 | \draw[gray] (1) to ($(1) + (120 : \disL)$); 61 | \draw[gray] (1) to ($(1) + (240 : \disL)$); 62 | \draw[gray] (1) to ($(1) + (300 : \disL)$); 63 | 64 | \draw[gray] (2) to ($(2) + (150 : \disL)$); 65 | \draw[gray] (2) to ($(2) + (300 : \disL)$); 66 | 67 | \draw[gray] (3) to ($(3) + ( 60 : \disL)$); 68 | \draw[gray] (3) to ($(3) + (210 : \disL)$); 69 | 70 | \draw[gray] (4) to ($(4) + (240 : \disL)$); 71 | \draw[gray] (4) to ($(4) + ( 30 : \disL)$); 72 | 73 | \draw[gray] (5) to ($(5) + (330 : \disL)$); 74 | \draw[gray] (5) to ($(5) + (120 : \disL)$); 75 | 76 | \draw[gray] (6) to ($(6) + ( 30 : \disL)$); 77 | \draw[gray] (6) to ($(6) + (150 : \disL)$); 78 | \draw[gray] (6) to ($(6) + (210 : \disL)$); 79 | \draw[gray] (6) to ($(6) + (330 : \disL)$); 80 | 81 | % Square-Kagome lattice sites 82 | \foreach \site in {1, 2, 3, 4, 5, 6} { 83 | \draw[thick, fill = white] (\site) circle (\tensorSizeL); 84 | } 85 | 86 | % draw coarse-grained tensor 87 | \draw[thick] (0, 0) to ($(-\disL, 0) + 0.5*(150 : {\disL}) + 0.5*(210 : {\disL})$); 88 | \draw[thick] (0, 0) to ($(0, +\disL) + 0.5*(60 : {\disL}) + 0.5*(120 : {\disL})$); 89 | \draw[thick] (0, 0) to ($(0, {- \disL - \disL / tan(30)}) + 0.5*(240 : {\disL}) + 0.5*(300 : {\disL})$); 90 | \draw[thick] (0, 0) to ($({+ \disL + \disL / tan(30)}, 0) + 0.5*(30 : {\disL}) + 0.5*(330 : {\disL})$); 91 | \draw[thick, fill = googleB] (0, 0) circle (\tensorSizeS); 92 | 93 | 94 | % draw unit cell borders 95 | \draw[gray, very thick, dotted] ($(3) + (135 : 0.30)$) to ($(5) + ( 45 : 0.30)$) to ($(6) + ( 30 : 0.30)$) to ($(6) + (330 : 0.30)$) to ($(4) + (315 : 0.30)$) to ($(1) + (300 : 0.30)$) to ($(1) + (240 : 0.30)$) to ($(2) + (225 : 0.30)$) -- cycle; 96 | 97 | \end{scope} 98 | } 99 | 100 | } 101 | 102 | \end{tikzpicture} 103 | 104 | \end{document} 105 | 106 | %%% Local Variables: 107 | %%% mode: latex 108 | %%% TeX-master: t 109 | %%% End: 110 | -------------------------------------------------------------------------------- /examples/heisenberg_afm_square.py: -------------------------------------------------------------------------------- 1 | import varipeps 2 | import jax 3 | import jax.numpy as jnp 4 | 5 | # Config Setting 6 | ## Set maximal steps for the CTMRG routine 7 | varipeps.config.ad_custom_max_steps = 100 8 | ## Set maximal steps for the fix point routine in the gradient calculation 9 | varipeps.config.ctmrg_max_steps = 100 10 | ## Set convergence threshold for the CTMRG routine 11 | varipeps.config.ctmrg_convergence_eps = 1e-7 12 | ## Set convergence threshold for the fix point routine in the gradient calculation 13 | varipeps.config.ad_custom_convergence_eps = 5e-8 14 | ## Enable/Disable printing of the convergence of the single CTMRG/gradient fix point steps. 15 | ## Useful to enable this during debugging, should be disabled for batch runs 16 | varipeps.config.ctmrg_print_steps = True 17 | varipeps.config.ad_custom_print_steps = False 18 | ## Select the method used to calculate the descent direction during optimization 19 | varipeps.config.optimizer_method = varipeps.config.Optimizing_Methods.CG 20 | ## Select the method used to calculate the (full) projectors in the CTMRG routine 21 | varipeps.config.ctmrg_full_projector_method = ( 22 | varipeps.config.Projector_Method.FISHMAN 23 | ) 24 | ## Set maximal steps for the optimization routine 25 | varipeps.config.optimizer_max_steps = 2000 26 | ## Increase enviroment bond dimension if truncation error is below this value 27 | varipeps.config.ctmrg_heuristic_increase_chi_threshold = 1e-4 28 | 29 | # Set constants for the simulation 30 | modelName = "HeisenbergModel" 31 | # Interaction strength 32 | J = 1 33 | # iPEPS bond dimension 34 | chiB = 2 35 | # Physical dimension 36 | p = 2 37 | # Maximal enviroment bond dimension 38 | maxChi = 36 39 | # Start value for enviroment bond dimension 40 | startChi = chiB**2 if chiB**2 < maxChi else maxChi 41 | 42 | # define spin-1/2 matrices 43 | Id = jnp.eye(2) 44 | Sx = jnp.array([[0, 1], [1, 0]]) / 2 45 | Sy = jnp.array([[0, -1j], [1j, 0]]) / 2 46 | Sz = jnp.array([[1, 0], [0, -1]]) / 2 47 | 48 | # construct Hamiltonian terms 49 | hamiltonianGates = J * (jnp.kron(Sx, Sx) + jnp.kron(Sy, Sy) + jnp.kron(Sz, Sz)) 50 | 51 | # create function to compute expectation values for the square Heisenberg AFM 52 | exp_func = varipeps.expectation.Two_Sites_Expectation_Value( 53 | horizontal_gates=(hamiltonianGates,), 54 | vertical_gates=(hamiltonianGates,), 55 | ) 56 | 57 | # Unit cell structure 58 | structure = [[0, 1], [1, 0]] 59 | 60 | # Create random initialization for the iPEPS unit cell 61 | unitcell = varipeps.peps.PEPS_Unit_Cell.random( 62 | structure, # Unit cell structure 63 | p, # Physical dimension 64 | chiB, # iPEPS bond dimension 65 | startChi, # Start value for enviroment bond dimension 66 | float, # Data type for the tensors: float (real) or complex tensors 67 | max_chi=maxChi, # Maximal enviroment bond dimension 68 | ) 69 | 70 | # Run optimization 71 | result = varipeps.optimization.optimize_peps_network( 72 | unitcell, 73 | exp_func, 74 | autosave_filename=f"data/autosave_square_chiB_{chiB:d}.hdf5", 75 | ) 76 | 77 | # Calculate magnetic expectation values 78 | Mag_Gates = [Sx, Sy, Sz] 79 | 80 | 81 | def calc_magnetic(unitcell): 82 | mag_result = [] 83 | for ti, t in enumerate(unitcell.get_unique_tensors()): 84 | r = varipeps.expectation.one_site.calc_one_site_multi_gates( 85 | t.tensor, t, Mag_Gates 86 | ) 87 | mag_result += r 88 | return mag_result 89 | 90 | 91 | magnetic_exp_values = calc_magnetic(result.unitcell) 92 | 93 | # Define some auxiliary data which should be stored along the final iPEPS unit cell 94 | auxiliary_data = { 95 | "best_energy": result.fun, 96 | "best_run": result.best_run, 97 | "magnetic_exp_values": magnetic_exp_values, 98 | } 99 | for k in sorted(result.max_trunc_error_list.keys()): 100 | auxiliary_data[f"max_trunc_error_list_{k:d}"] = result.max_trunc_error_list[k] 101 | auxiliary_data[f"step_energies_{k:d}"] = result.step_energies[k] 102 | auxiliary_data[f"step_chi_{k:d}"] = result.step_chi[k] 103 | auxiliary_data[f"step_conv_{k:d}"] = result.step_conv[k] 104 | auxiliary_data[f"step_runtime_{k:d}"] = result.step_runtime[k] 105 | 106 | # save full iPEPS state 107 | result.unitcell.save_to_file( 108 | f"data/heisenberg_square_J_{J:d}_chiB_{chiB:d}_chiMax_{chiM:d}.hdf5", 109 | auxiliary_data=auxiliary_data, 110 | ) 111 | -------------------------------------------------------------------------------- /varipeps/expectation/four_sites.py: -------------------------------------------------------------------------------- 1 | from functools import partial 2 | 3 | import jax.numpy as jnp 4 | from jax import jit 5 | 6 | from varipeps.peps import PEPS_Tensor 7 | from varipeps.contractions import apply_contraction_jitted 8 | 9 | from typing import Sequence, List, Tuple, Literal 10 | 11 | Corner_Literal = Literal["top-left", "top-right", "bottom-left", "bottom-right"] 12 | 13 | 14 | @partial(jit, static_argnums=(5,)) 15 | def _four_sites_quadrat_workhorse( 16 | top_left: jnp.ndarray, 17 | top_right: jnp.ndarray, 18 | bottom_left: jnp.ndarray, 19 | bottom_right: jnp.ndarray, 20 | gates: Tuple[jnp.ndarray, ...], 21 | real_result: bool = False, 22 | ) -> List[jnp.ndarray]: 23 | density_matrix = jnp.tensordot(top_left, top_right, ((5, 6, 7), (2, 3, 4))) 24 | density_matrix = jnp.tensordot(density_matrix, bottom_left, ((2, 3, 4), (5, 6, 7))) 25 | density_matrix = jnp.tensordot( 26 | density_matrix, bottom_right, ((4, 5, 6, 9, 10, 11), (2, 3, 4, 5, 6, 7)) 27 | ) 28 | 29 | density_matrix = density_matrix.transpose(0, 2, 4, 6, 1, 3, 5, 7) 30 | density_matrix = density_matrix.reshape( 31 | density_matrix.shape[0] 32 | * density_matrix.shape[1] 33 | * density_matrix.shape[2] 34 | * density_matrix.shape[3], 35 | density_matrix.shape[4] 36 | * density_matrix.shape[5] 37 | * density_matrix.shape[6] 38 | * density_matrix.shape[7], 39 | ) 40 | 41 | norm = jnp.trace(density_matrix) 42 | 43 | if real_result: 44 | return [ 45 | jnp.real(jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm) 46 | for g in gates 47 | ] 48 | else: 49 | return [ 50 | jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm for g in gates 51 | ] 52 | 53 | 54 | def calc_four_sites_quadrat_multiple_gates( 55 | peps_tensors: Sequence[jnp.ndarray], 56 | peps_tensor_objs: Sequence[PEPS_Tensor], 57 | gates: Sequence[jnp.ndarray], 58 | ) -> List[jnp.ndarray]: 59 | """ 60 | Calculate the four site expectation values for three as quadrat ordered 61 | PEPS tensor and their environment. 62 | 63 | The order of the PEPS sequence have to be 64 | [top-left, top-right, bottom-left, bottom-right]. 65 | 66 | The gate is applied in the order [top-left, top-right, bottom-left, bottom-right]. 67 | 68 | Args: 69 | peps_tensors (:term:`sequence` of :obj:`jax.numpy.ndarray`): 70 | The PEPS tensor arrays. Have to be the same objects as the tensor 71 | attribute of the `peps_tensor_obj` argument. 72 | peps_tensor_objs (:term:`sequence` of :obj:`~varipeps.peps.PEPS_Tensor`): 73 | PEPS tensor objects. 74 | gates (:term:`sequence` of :obj:`jax.numpy.ndarray`): 75 | Sequence with the gates which should be applied to the PEPS tensors. 76 | Gates are expected to be a matrix with first axis corresponding to 77 | the Hilbert space and the second axis corresponding to the dual room. 78 | Returns: 79 | :obj:`list` of :obj:`jax.numpy.ndarray`: 80 | List with the calculated expectation values of each gate. 81 | """ 82 | density_matrix_top_left = apply_contraction_jitted( 83 | "density_matrix_four_sites_top_left", 84 | [peps_tensors[0]], 85 | [peps_tensor_objs[0]], 86 | [], 87 | ) 88 | 89 | density_matrix_top_right = apply_contraction_jitted( 90 | "density_matrix_four_sites_top_right", 91 | [peps_tensors[1]], 92 | [peps_tensor_objs[1]], 93 | [], 94 | ) 95 | 96 | density_matrix_bottom_left = apply_contraction_jitted( 97 | "density_matrix_four_sites_bottom_left", 98 | [peps_tensors[2]], 99 | [peps_tensor_objs[2]], 100 | [], 101 | ) 102 | 103 | density_matrix_bottom_right = apply_contraction_jitted( 104 | "density_matrix_four_sites_bottom_right", 105 | [peps_tensors[3]], 106 | [peps_tensor_objs[3]], 107 | [], 108 | ) 109 | 110 | real_result = all(jnp.allclose(g, g.T.conj()) for g in gates) 111 | 112 | return _four_sites_quadrat_workhorse( 113 | density_matrix_top_left, 114 | density_matrix_top_right, 115 | density_matrix_bottom_left, 116 | density_matrix_bottom_right, 117 | tuple(gates), 118 | real_result, 119 | ) 120 | -------------------------------------------------------------------------------- /docs/source/images/maple_leaf_structure.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{shapes.geometric,patterns,positioning,matrix} 9 | \usetikzlibrary{shadows,calc,3d,arrows.meta,decorations.pathmorphing,decorations.markings,decorations.pathreplacing} 10 | 11 | \definecolor{googleB}{HTML}{4285F4} 12 | \definecolor{googleG}{HTML}{34A853} 13 | \definecolor{googleY}{HTML}{FBBC05} 14 | \definecolor{googleR}{HTML}{EA4335} 15 | \definecolor{googleBG}{HTML}{3B96A4} 16 | 17 | % load TikZ grafic definitions 18 | %\input{gfx_TikZ} 19 | 20 | % main document 21 | \begin{document} 22 | 23 | \begin{tikzpicture} 24 | 25 | \def\clipX{2.00} 26 | \def\clipY{1.75} 27 | \def\legLength{0.85} 28 | \def\tensorSize{0.1} 29 | \def\alpha{19.1066} 30 | 31 | % lattice vectors 32 | \begin{scope}[shift = {(0, 0)}] 33 | \draw[thick, -{Stealth[scale = 1.0]}] (0, 0) to ({-1*cos(30)*\legLength*sin(30)/sin(\alpha)}, {-2*cos(30)*tan(60)/2*\legLength*sin(30)/sin(\alpha)}) node at ($(240 : 1.25) + (150 : 0.25)$) {$\boldsymbol{a}_1$}; 34 | \draw[thick, -{Stealth[scale = 1.0]}] (0, 0) to ({+2*cos(30)*\legLength*sin(30)/sin(\alpha)}, {+0*cos(30)*tan(60)/2*\legLength*sin(30)/sin(\alpha)}) node at ($( 0 : 1.00) + ( 90 : 0.25)$) {$\boldsymbol{a}_2$}; 35 | \end{scope} 36 | 37 | % maple-leaf unit cells 38 | \begin{scope}[shift = {(0, 0)}] 39 | 40 | \foreach \x/\y in {0/0, 2/0, 4/0, -1/-2, +1/-2, +3/-2} { 41 | 42 | \begin{scope}[shift = {({\x*cos(30)*\legLength*sin(30)/sin(\alpha)}, {\y*cos(30)*tan(60)/2*\legLength*sin(30)/sin(\alpha)}, 0)}] 43 | 44 | \coordinate (1) at (0, 0); 45 | \coordinate (2) at ({-\alpha - 60} : {1*\legLength}); 46 | \coordinate (3) at ({-\alpha - 60} : {2*\legLength}); 47 | \coordinate (4) at ($(2) + ({-\alpha} : \legLength)$); 48 | \coordinate (5) at ($(1) + ({-\alpha} : \legLength)$); 49 | \coordinate (6) at ({-\alpha} : {2*\legLength}); 50 | 51 | % internal links 52 | \draw[ultra thick, googleG] (1) to (2); 53 | \draw[ultra thick, googleG] (3) to (4); 54 | \draw[ultra thick, googleG] (5) to (6); 55 | \draw[thick, googleB, densely dashed] (1) to (5); 56 | \draw[thick, googleB, densely dashed] (2) to (3); 57 | \draw[thick, googleB, densely dashed] (4) to (6); 58 | \draw[thick, googleR, densely dotted] (2) to (5) to (4) to (2); 59 | 60 | % external links 61 | \draw[thick, googleB, densely dashed] (1) to ($(1) + ({120 - \alpha} : 0.5 * \legLength)$); 62 | \draw[thick, googleR, densely dotted] (1) to ($(1) + ({180 - \alpha} : 0.5 * \legLength)$); 63 | \draw[thick, googleR, densely dotted] (1) to ($(1) + ({240 - \alpha} : 0.5 * \legLength)$); 64 | 65 | \draw[thick, googleB, densely dashed] (2) to ($(2) + ({180 - \alpha} : 0.5 * \legLength)$); 66 | 67 | \draw[thick, googleB, densely dashed] (3) to ($(3) + ({240 - \alpha} : 0.5 * \legLength)$); 68 | \draw[thick, googleR, densely dotted] (3) to ($(3) + ({300 - \alpha} : 0.5 * \legLength)$); 69 | \draw[thick, googleR, densely dotted] (3) to ($(3) + ({360 - \alpha} : 0.5 * \legLength)$); 70 | 71 | \draw[thick, googleB, densely dashed] (4) to ($(4) + ({300 - \alpha} : 0.5 * \legLength)$); 72 | 73 | \draw[thick, googleB, densely dashed] (5) to ($(5) + ({ 60 - \alpha} : 0.5 * \legLength)$); 74 | 75 | \draw[thick, googleB, densely dashed] (6) to ($(6) + ({360 - \alpha} : 0.5 * \legLength)$); 76 | \draw[thick, googleR, densely dotted] (6) to ($(6) + ({ 60 - \alpha} : 0.5 * \legLength)$); 77 | \draw[thick, googleR, densely dotted] (6) to ($(6) + ({120 - \alpha} : 0.5 * \legLength)$); 78 | 79 | % lattice site 80 | \foreach \siteIdx in {1, 2, 3, 4, 5, 6} { 81 | \draw[black, fill = black] (\siteIdx) circle (\tensorSize); 82 | \draw[black, fill = black] (\siteIdx) circle (\tensorSize) node[white] at (\siteIdx) {\tiny$\siteIdx$}; 83 | } 84 | 85 | \draw[thick, gray, dotted, rounded corners] ($(1) + ({150 - \alpha} : 0.5 * \legLength)$) to ($(3) + ({270 - \alpha} : 0.5 * \legLength)$) to ($(6) + ({ 30 - \alpha} : 0.5 * \legLength)$) -- cycle; 86 | 87 | \end{scope} 88 | 89 | } 90 | 91 | \end{scope} 92 | 93 | \end{tikzpicture} 94 | 95 | \end{document} 96 | 97 | %%% Local Variables: 98 | %%% mode: latex 99 | %%% TeX-master: t 100 | %%% End: 101 | -------------------------------------------------------------------------------- /varipeps/contractions/apply.py: -------------------------------------------------------------------------------- 1 | """ 2 | Helpers to apply contractions. 3 | """ 4 | 5 | from functools import partial 6 | 7 | import jax 8 | import jax.numpy as jnp 9 | 10 | from varipeps.peps import PEPS_Tensor 11 | 12 | from .definitions import Definitions, Definition 13 | 14 | from typing import Sequence, List, Tuple, Dict, Union, Optional 15 | 16 | 17 | @partial( 18 | jax.jit, static_argnames=("name", "disable_identity_check") 19 | ) 20 | def apply_contraction( 21 | name: str, 22 | peps_tensors: Sequence[jnp.ndarray], 23 | peps_tensor_objs: Sequence[PEPS_Tensor], 24 | additional_tensors: Sequence[jnp.ndarray], 25 | *, 26 | disable_identity_check: bool = True, 27 | ) -> jnp.ndarray: 28 | """ 29 | Apply a contraction to a list of tensors. 30 | 31 | For details on the contractions and their definition see 32 | :class:`varipeps.contractions.Definitions`. 33 | 34 | Args: 35 | name (:obj:`str`): 36 | Name of the contraction. Must be a class attribute of the class 37 | :class:`varipeps.contractions.Definitions`. 38 | peps_tensors (:term:`sequence` of :obj:`jax.numpy.ndarray`): 39 | The PEPS tensor arrays that should be contracted. 40 | peps_tensor_objs (:term:`sequence` of :obj:`~varipeps.peps.PEPS_Tensor`): 41 | The PEPS tensor objects corresponding the the arrays. These arguments are 42 | split up due to limitation of the jax library. 43 | additional_tensors (:term:`sequence` of :obj:`jax.numpy.ndarray`): 44 | Additional non-PEPS tensors which should be contracted (e.g. gates). 45 | Keyword args: 46 | disable_identity_check (:obj:`bool`): 47 | Disable the check if the tensor is identical to the one of the 48 | corresponding object. 49 | Returns: 50 | jax.numpy.ndarray: 51 | The contracted tensor. 52 | """ 53 | if len(peps_tensors) != len(peps_tensor_objs): 54 | raise ValueError( 55 | "Number of PEPS tensors have to match number of PEPS tensor objects." 56 | ) 57 | 58 | if ( 59 | not disable_identity_check 60 | and not all(isinstance(t, jax.core.Tracer) for t in peps_tensors) 61 | and not all(isinstance(to.tensor, jax.core.Tracer) for to in peps_tensor_objs) 62 | and not all( 63 | jnp.allclose(peps_tensors[i], peps_tensor_objs[i].tensor) 64 | for i in range(len(peps_tensors)) 65 | ) 66 | ): 67 | raise ValueError( 68 | "Sequence of PEPS tensors mismatch the objects sequence. Please check your code!" 69 | ) 70 | 71 | contraction = getattr(Definitions, name) 72 | 73 | if len(contraction["filter_peps_tensors"]) != len(peps_tensors): 74 | raise ValueError( 75 | f"Number of PEPS tensor ({len(peps_tensors)}) objects does not fit the expected number ({len(contraction['filter_peps_tensors'])})." 76 | ) 77 | 78 | if len(contraction["filter_additional_tensors"]) != len(additional_tensors): 79 | raise ValueError( 80 | f"Number of additional tensor ({len(additional_tensors)}) objects does not fit the expected number ({len(contraction['filter_additional_tensors'])})." 81 | ) 82 | 83 | if not isinstance(additional_tensors, list): 84 | additional_tensors = list(additional_tensors) 85 | 86 | tensors = [] 87 | 88 | for ti, t_filter in enumerate(contraction["filter_peps_tensors"]): 89 | for f in t_filter: 90 | if f == "tensor": 91 | tensors.append(peps_tensors[ti]) 92 | elif f == "tensor_conj": 93 | if ( 94 | hasattr(peps_tensor_objs[ti], "tensor_conj") 95 | and peps_tensor_objs[ti].tensor_conj is not None 96 | ): 97 | tensors.append(peps_tensor_objs[ti].tensor_conj) 98 | else: 99 | tensors.append(peps_tensors[ti].conj()) 100 | else: 101 | tensors.append(getattr(peps_tensor_objs[ti], f)) 102 | 103 | tensors += additional_tensors 104 | 105 | tensor_shapes = tuple(tuple(e.shape) for e in tensors) 106 | 107 | return jnp.einsum( 108 | contraction["einsum_network"], 109 | *tensors, 110 | optimize="optimal" if len(tensors) < 10 else "dp", 111 | ) 112 | 113 | 114 | apply_contraction_jitted = apply_contraction 115 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # variPEPS -- Versatile tensor network library for variational ground state simulations in two spatial dimensions. 3 | 4 | [![DOI](https://zenodo.org/badge/773767511.svg)](https://zenodo.org/doi/10.5281/zenodo.10852390) 5 | [![Documentation Status](https://readthedocs.org/projects/varipeps/badge/?version=latest)](https://varipeps.readthedocs.io/en/stable/?badge=latest) 6 | [![PyPI - Version](https://img.shields.io/pypi/v/varipeps)](https://pypi.org/project/variPEPS/) 7 | 8 | variPEPS is the Python variant of the tensor network library developed for 9 | variational ground state simulations in two spatial dimensions applying gradient 10 | optimization using automatic differentation. 11 | 12 | For a detailed report on the method, please see our publications listed at the 13 | end of this readme. 14 | 15 | ## Installation 16 | ### Installation using pip 17 | The current version of the variPEPS Python package is available on 18 | [PyPI](https://pypi.org/project/variPEPS/). 19 | It can be easily installed by using the Python package manager pip: 20 | ```bash 21 | $ python3 -m pip install variPEPS 22 | ``` 23 | 24 | ## Usage 25 | 26 | For detailed information how to use the package we want to point out to the 27 | [documentation of the project](https://varipeps.readthedocs.io/en/stable). 28 | 29 | ## Citation 30 | 31 | We are happy if you want to use the framework for your research. For the 32 | citation of our work we ask to use the following references (the publications 33 | with the method description and the Zenodo reference for this Git repository): 34 | * J. Naumann, E. L. Weerda, M. Rizzi, J. Eisert, and P. Schmoll, An introduction 35 | to infinite projected entangled-pair state methods for variational ground 36 | state simulations using automatic differentiation, SciPost Phys. Lect. Notes 37 | 86 (2024), 38 | doi:[10.21468/SciPostPhysLectNotes.86](https://doi.org/10.21468/SciPostPhysLectNotes.86). 39 | * J. Naumann, E. L. Weerda, J. Eisert, M. Rizzi and P. Schmoll, Variationally 40 | optimizing infinite projected entangled-pair states at large bond dimensions: 41 | A split corner transfer matrix renormalization group approach, Phys. Rev. B 42 | 111, 235116 (2025), 43 | doi:[10.1103/PhysRevB.111.235116](https://doi.org/10.1103/PhysRevB.111.235116). 44 | * J. Naumann, J. Eisert, P. Schmoll, Variational optimization of projected 45 | entangled-pair states on the triangular lattice, 46 | [arXiv:2510.04907](https://arxiv.org/abs/2510.04907) 47 | * J. Naumann, P. Schmoll, R. Losada, F. Wilde, and F. Krein, [variPEPS (Python 48 | version)](https://zenodo.org/doi/10.5281/zenodo.10852390), Zenodo. 49 | 50 | The BibTeX code for these references are: 51 | ```bibtex 52 | @article{10.21468/SciPostPhysLectNotes.86, 53 | title={{An introduction to infinite projected entangled-pair state methods for variational ground state simulations using automatic differentiation}}, 54 | author={Jan Naumann and Erik Lennart Weerda and Matteo Rizzi and Jens Eisert and Philipp Schmoll}, 55 | journal={SciPost Phys. Lect. Notes}, 56 | pages={86}, 57 | year={2024}, 58 | publisher={SciPost}, 59 | doi={10.21468/SciPostPhysLectNotes.86}, 60 | url={https://scipost.org/10.21468/SciPostPhysLectNotes.86}, 61 | } 62 | 63 | @article{PhysRevB.111.235116, 64 | title = {Variationally optimizing infinite projected entangled-pair states at large bond dimensions: A split corner transfer matrix renormalization group approach}, 65 | author = {Naumann, Jan and Weerda, Erik L. and Eisert, Jens and Rizzi, Matteo and Schmoll, Philipp}, 66 | journal = {Phys. Rev. B}, 67 | volume = {111}, 68 | issue = {23}, 69 | pages = {235116}, 70 | numpages = {12}, 71 | year = {2025}, 72 | month = {Jun}, 73 | publisher = {American Physical Society}, 74 | doi = {10.1103/PhysRevB.111.235116}, 75 | url = {https://link.aps.org/doi/10.1103/PhysRevB.111.235116} 76 | } 77 | 78 | @misc{naumann2025variationaloptimizationprojectedentangledpair, 79 | title={Variational optimization of projected entangled-pair states on the triangular lattice}, 80 | author={Jan Naumann and Jens Eisert and Philipp Schmoll}, 81 | year={2025}, 82 | eprint={2510.04907}, 83 | archivePrefix={arXiv}, 84 | primaryClass={cond-mat.str-el}, 85 | url={https://arxiv.org/abs/2510.04907}, 86 | } 87 | 88 | @software{naumann_varipeps_python, 89 | author = {Jan Naumann and Philipp Schmoll and Roberto Losada and Frederik Wilde and Finn Krein}, 90 | title = {{variPEPS (Python version)}}, 91 | howpublished = {Zenodo}, 92 | url = {https://doi.org/10.5281/ZENODO.10852390}, 93 | doi = {10.5281/ZENODO.10852390}, 94 | } 95 | ``` 96 | -------------------------------------------------------------------------------- /varipeps/corrlength/triangular_corrlength.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from scipy.sparse.linalg import LinearOperator, eigs 3 | 4 | import jax.numpy as jnp 5 | 6 | from varipeps.contractions import apply_contraction_jitted 7 | from varipeps.peps import PEPS_Unit_Cell 8 | 9 | 10 | def calculate_triangular_correlation_length(unitcell: PEPS_Unit_Cell): 11 | initial_vector_60 = apply_contraction_jitted( 12 | "triangular_ctmrg_corrlen_vec_60", 13 | (unitcell[-1, 0][0][0].tensor,), 14 | (unitcell[-1, 0][0][0],), 15 | (), 16 | ) 17 | initial_vector_60 = initial_vector_60.reshape(-1) 18 | 19 | initial_vector_120 = apply_contraction_jitted( 20 | "triangular_ctmrg_corrlen_vec_120", 21 | (unitcell[-1, -1][0][0].tensor,), 22 | (unitcell[-1, -1][0][0],), 23 | (), 24 | ) 25 | initial_vector_120 = initial_vector_120.reshape(-1) 26 | 27 | initial_vector_180 = apply_contraction_jitted( 28 | "triangular_ctmrg_corrlen_vec_180", 29 | (unitcell[0, -1][0][0].tensor,), 30 | (unitcell[0, -1][0][0],), 31 | (), 32 | ) 33 | initial_vector_180 = initial_vector_180.reshape(-1) 34 | 35 | def matvec_60(vec): 36 | vec = jnp.asarray(vec) 37 | for _, view in unitcell.iter_one_column(0): 38 | if vec.ndim != 4: 39 | vec = vec.reshape( 40 | view[0, 0][0][0].T6b.shape[3], 41 | view[0, 0][0][0].tensor.shape[1], 42 | view[0, 0][0][0].tensor.shape[1], 43 | view[0, 0][0][0].T3a.shape[0], 44 | ) 45 | vec = apply_contraction_jitted( 46 | "triangular_ctmrg_corrlen_absorb_60", 47 | (view[0, 0][0][0].tensor,), 48 | (view[0, 0][0][0],), 49 | (vec,), 50 | ) 51 | return vec.reshape(-1) 52 | 53 | def matvec_120(vec): 54 | vec = jnp.asarray(vec) 55 | for _, view in unitcell.iter_main_diagonal(): 56 | if vec.ndim != 4: 57 | vec = vec.reshape( 58 | view[0, 0][0][0].T2a.shape[0], 59 | view[0, 0][0][0].tensor.shape[0], 60 | view[0, 0][0][0].tensor.shape[0], 61 | view[0, 0][0][0].T5b.shape[3], 62 | ) 63 | vec = apply_contraction_jitted( 64 | "triangular_ctmrg_corrlen_absorb_120", 65 | (view[0, 0][0][0].tensor,), 66 | (view[0, 0][0][0],), 67 | (vec,), 68 | ) 69 | return vec.reshape(-1) 70 | 71 | def matvec_180(vec): 72 | vec = jnp.asarray(vec) 73 | for _, view in unitcell.iter_one_row(0): 74 | if vec.ndim != 4: 75 | vec = vec.reshape( 76 | view[0, 0][0][0].T1a.shape[0], 77 | view[0, 0][0][0].tensor.shape[5], 78 | view[0, 0][0][0].tensor.shape[5], 79 | view[0, 0][0][0].T4b.shape[3], 80 | ) 81 | vec = apply_contraction_jitted( 82 | "triangular_ctmrg_corrlen_absorb_180", 83 | (view[0, 0][0][0].tensor,), 84 | (view[0, 0][0][0],), 85 | (vec,), 86 | ) 87 | return vec.reshape(-1) 88 | 89 | lin_op_60 = LinearOperator( 90 | (initial_vector_60.shape[0], initial_vector_60.shape[0]), 91 | matvec=matvec_60, 92 | ) 93 | 94 | lin_op_120 = LinearOperator( 95 | (initial_vector_120.shape[0], initial_vector_120.shape[0]), 96 | matvec=matvec_120, 97 | ) 98 | 99 | lin_op_180 = LinearOperator( 100 | (initial_vector_180.shape[0], initial_vector_180.shape[0]), 101 | matvec=matvec_180, 102 | ) 103 | 104 | eig_60, eigvec_60 = eigs(lin_op_60, k=5, v0=initial_vector_60, which="LM") 105 | 106 | eig_60 = eig_60[np.argsort(np.abs(eig_60))[::-1]] 107 | eig_60 /= np.abs(eig_60[0]) 108 | 109 | corr_len_60 = -1 / np.log(np.abs(eig_60[1])) 110 | 111 | eig_120, eigvec_120 = eigs(lin_op_120, k=5, v0=initial_vector_120, which="LM") 112 | 113 | eig_120 = eig_120[np.argsort(np.abs(eig_120))[::-1]] 114 | eig_120 /= np.abs(eig_120[0]) 115 | 116 | corr_len_120 = -1 / np.log(np.abs(eig_120[1])) 117 | 118 | eig_180, eigvec_180 = eigs(lin_op_180, k=5, v0=initial_vector_180, which="LM") 119 | 120 | eig_180 = eig_180[np.argsort(np.abs(eig_180))[::-1]] 121 | eig_180 /= np.abs(eig_180[0]) 122 | 123 | corr_len_180 = -1 / np.log(np.abs(eig_180[1])) 124 | 125 | return (corr_len_60, eig_60), (corr_len_120, eig_120), (corr_len_180, eig_180) 126 | -------------------------------------------------------------------------------- /varipeps/utils/projector_dict.py: -------------------------------------------------------------------------------- 1 | from collections import namedtuple 2 | import collections.abc 3 | from dataclasses import dataclass, field 4 | 5 | from typing import Sequence, Tuple, List, Dict, TypeVar, Any 6 | 7 | Left_Projectors = namedtuple("Left_Projectors", ("top", "bottom")) 8 | Right_Projectors = namedtuple("Right_Projectors", ("top", "bottom")) 9 | Top_Projectors = namedtuple("Top_Projectors", ("left", "right")) 10 | Bottom_Projectors = namedtuple("Bottom_Projectors", ("left", "right")) 11 | 12 | Left_Projectors_Split_Transfer = namedtuple( 13 | "Left_Projectors_Split_Transfer", 14 | ( 15 | "top_ket", 16 | "top_bra", 17 | "top_phys_ket", 18 | "top_phys_bra", 19 | "bottom_ket", 20 | "bottom_bra", 21 | "bottom_phys_ket", 22 | "bottom_phys_bra", 23 | ), 24 | ) 25 | Right_Projectors_Split_Transfer = namedtuple( 26 | "Right_Projectors_Split_Transfer", 27 | ( 28 | "top_ket", 29 | "top_bra", 30 | "top_phys_ket", 31 | "top_phys_bra", 32 | "bottom_ket", 33 | "bottom_bra", 34 | "bottom_phys_ket", 35 | "bottom_phys_bra", 36 | ), 37 | ) 38 | Top_Projectors_Split_Transfer = namedtuple( 39 | "Top_Projectors_Split_Transfer", 40 | ( 41 | "left_ket", 42 | "left_bra", 43 | "left_phys_ket", 44 | "left_phys_bra", 45 | "right_ket", 46 | "right_bra", 47 | "right_phys_ket", 48 | "right_phys_bra", 49 | ), 50 | ) 51 | Bottom_Projectors_Split_Transfer = namedtuple( 52 | "Bottom_Projectors_Split_Transfer", 53 | ( 54 | "left_ket", 55 | "left_bra", 56 | "left_phys_ket", 57 | "left_phys_bra", 58 | "right_ket", 59 | "right_bra", 60 | "right_phys_ket", 61 | "right_phys_bra", 62 | ), 63 | ) 64 | 65 | Unit_Cell_Bond_Dim_Projectors = namedtuple( 66 | "Unit_Cell_Bond_Dim_Projectors", ("left", "right", "top", "bottom") 67 | ) 68 | 69 | T_Projector = TypeVar( 70 | "T_Projector", Left_Projectors, Right_Projectors, Top_Projectors, Bottom_Projectors 71 | ) 72 | 73 | T_Projector_Split_Transfer = TypeVar( 74 | "T_Projector_Split_Transfer", 75 | Left_Projectors_Split_Transfer, 76 | Right_Projectors_Split_Transfer, 77 | Top_Projectors_Split_Transfer, 78 | Bottom_Projectors_Split_Transfer, 79 | ) 80 | 81 | 82 | @dataclass 83 | class Projector_Dict(collections.abc.MutableMapping): 84 | max_x: int 85 | max_y: int 86 | projector_dict: Dict[Tuple[int, int], T_Projector] = field(default_factory=dict) # type: ignore 87 | 88 | def __getitem__(self, key: Tuple[int, int]) -> T_Projector: 89 | return self.projector_dict[key] 90 | 91 | def __setitem__(self, key: Tuple[int, int], value: T_Projector) -> None: 92 | key = (key[0] % self.max_x, key[1] % self.max_y) 93 | self.projector_dict[key] = value 94 | 95 | def __delitem__(self, key: Tuple[int, int]) -> None: 96 | self.projector_dict.__delitem__(key) 97 | 98 | def __iter__(self): 99 | return self.projector_dict.__iter__() 100 | 101 | def __len__(self): 102 | return self.projector_dict.__len__() 103 | 104 | def get_projector( 105 | self, 106 | current_x: int, 107 | current_y: int, 108 | relative_x: int, 109 | relative_y: int, 110 | ) -> T_Projector: 111 | select_x = (current_x + relative_x) % self.max_x 112 | select_y = (current_y + relative_y) % self.max_y 113 | 114 | return self.projector_dict[(select_x, select_y)] 115 | 116 | 117 | @dataclass 118 | class Projector_Dict_Triangular(collections.abc.MutableMapping): 119 | view: Any 120 | max_x: int 121 | max_y: int 122 | projector_dict: Dict[int, Any] = field(default_factory=dict) # type: ignore 123 | 124 | def __getitem__(self, key: int): 125 | return self.projector_dict[key] 126 | 127 | def __setitem__(self, key: Tuple[int, int], value) -> None: 128 | key = self.view.get_indices(key)[0][0] 129 | self.projector_dict[key] = value 130 | 131 | def __delitem__(self, key: int) -> None: 132 | self.projector_dict.__delitem__(key) 133 | 134 | def __iter__(self): 135 | return self.projector_dict.__iter__() 136 | 137 | def __len__(self): 138 | return self.projector_dict.__len__() 139 | 140 | def get_projector( 141 | self, 142 | current_x: int, 143 | current_y: int, 144 | relative_x: int, 145 | relative_y: int, 146 | ) -> T_Projector: 147 | select_x = (current_x + relative_x) % self.max_x 148 | select_y = (current_y + relative_y) % self.max_y 149 | 150 | key = self.view.get_indices((select_x, select_y))[0][0] 151 | 152 | return self.projector_dict[key] 153 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | import importlib 16 | import importlib.metadata 17 | import inspect 18 | 19 | sys.path.insert(0, os.path.abspath("..")) 20 | 21 | 22 | # -- Project information ----------------------------------------------------- 23 | 24 | project = "varipeps" 25 | copyright = "2021-2025, Jan Naumann, Philipp Schmoll, Roberto Losada, Frederik Wilde, Finn Krein" 26 | author = "Jan Naumann, Philipp Schmoll, Roberto Losada, Frederik Wilde, Finn Krein" 27 | 28 | # The full version, including alpha/beta/rc tags 29 | release = importlib.metadata.version("varipeps") 30 | 31 | 32 | # -- General configuration --------------------------------------------------- 33 | 34 | # Add any Sphinx extension module names here, as strings. They can be 35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 36 | # ones. 37 | extensions = [ 38 | "sphinx.ext.autodoc", 39 | "sphinx.ext.autosummary", 40 | "sphinx.ext.linkcode", 41 | "sphinx.ext.mathjax", 42 | "sphinx.ext.napoleon", 43 | "sphinx.ext.intersphinx", 44 | "sphinx_autodoc_defaultargs", 45 | "sphinx_subfigure", 46 | ] 47 | 48 | napoleon_include_private_with_doc = True 49 | napoleon_preprocess_types = False 50 | 51 | autodoc_type_aliases = { 52 | "T_PEPS_Unit_Cell": "PEPS_Unit_Cell", 53 | "T_PEPS_Tensor": "PEPS_Tensor", 54 | "PEPS_Unit_Cell.Unit_Cell_Data": "varipeps.peps.PEPS_Unit_Cell.Unit_Cell_Data", 55 | "jax._src.numpy.lax_numpy.ndarray": "jax.numpy.ndarray", 56 | "h5py._hl.group.Group": "h5py.Group", 57 | } 58 | 59 | # autodoc_mock_imports = ["jax"] 60 | 61 | intersphinx_mapping = { 62 | "python": ("https://docs.python.org/3", None), 63 | "jax": ("https://jax.readthedocs.io/en/latest/", None), 64 | "numpy": ("https://numpy.org/doc/stable/", None), 65 | "scipy": ("https://docs.scipy.org/doc/scipy/reference/", None), 66 | "h5py": ("https://docs.h5py.org/en/stable/", None), 67 | } 68 | 69 | # Add any paths that contain templates here, relative to this directory. 70 | templates_path = ["_templates"] 71 | 72 | # List of patterns, relative to source directory, that match files and 73 | # directories to ignore when looking for source files. 74 | # This pattern also affects html_static_path and html_extra_path. 75 | exclude_patterns = [] 76 | 77 | from varipeps import git_commit, git_tag 78 | 79 | code_url = "https://github.com/variPEPS/variPEPS_Python/blob/{blob}" 80 | 81 | if git_tag is not None: 82 | code_url = code_url.format(blob=git_tag) 83 | elif git_commit is not None: 84 | code_url = code_url.format(blob=git_commit) 85 | else: 86 | code_url = code_url.format(blob=release) 87 | 88 | 89 | def linkcode_resolve(domain, info): 90 | # Code adapted from function in websockets module 91 | # https://github.com/python-websockets/websockets/blob/e217458ef8b692e45ca6f66c5aeb7fad0aee97ee/docs/conf.py 92 | 93 | if domain != "py": 94 | return None 95 | if not info["module"]: 96 | return None 97 | 98 | mod = importlib.import_module(info["module"]) 99 | if "." in info["fullname"]: 100 | objname_parts = info["fullname"].split(".") 101 | 102 | obj = getattr(mod, objname_parts[0]) 103 | 104 | for name in objname_parts[1:-1]: 105 | obj = getattr(obj, name) 106 | 107 | attrname = objname_parts[-1] 108 | 109 | try: 110 | # object is a method of a class 111 | obj = getattr(obj, attrname) 112 | except AttributeError: 113 | # object is an attribute of a class 114 | return None 115 | else: 116 | obj = getattr(mod, info["fullname"]) 117 | 118 | try: 119 | filename = inspect.getsourcefile(obj) 120 | lines = inspect.getsourcelines(obj) 121 | except (TypeError, OSError): 122 | # e.g. object is a typing.Union 123 | return None 124 | 125 | filename = os.path.relpath(filename, os.path.abspath("../..")) 126 | 127 | if not filename.startswith("varipeps"): 128 | # e.g. object is a typing.NewType 129 | return None 130 | start, end = lines[1], lines[1] + len(lines[0]) - 1 131 | 132 | return f"{code_url}/{filename}#L{start}-L{end}" 133 | 134 | 135 | # -- Options for HTML output ------------------------------------------------- 136 | 137 | # The theme to use for HTML and HTML Help pages. See the documentation for 138 | # a list of builtin themes. 139 | # 140 | html_theme = "sphinx_rtd_theme" 141 | 142 | # Add any paths that contain custom static files (such as style sheets) here, 143 | # relative to this directory. They are copied after the builtin static files, 144 | # so a file named "default.css" will overwrite the builtin "default.css". 145 | html_static_path = ["_static"] 146 | 147 | rst_prolog = """ 148 | .. |default| raw:: html 149 | 150 |
Default:""" 151 | -------------------------------------------------------------------------------- /docs/source/images/floret_pentagon_bond_colors.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{math, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \pgfdeclarelayer{v1} % background layer 17 | \pgfdeclarelayer{v2} % foreground layer 18 | \pgfsetlayers{v1,main,v2} % set the order of the layers (main is the standard layer) 19 | \tikzset{ 20 | bonda/.style={black, line width=.65pt}, 21 | bondb/.style={blue!80!white, line width=.65pt}, 22 | bondc/.style={green!80!black, line width=0.65pt}} 23 | 24 | \begin{tikzpicture} 25 | \tikzmath { 26 | \ang0 = 0; 27 | \lb = 0.5; 28 | \la = 2*\lb; 29 | int \sa; 30 | int \sb; 31 | \nt = 1; 32 | for \sa in {-\nt,...,\nt}{ 33 | int \sbmin, \sbmax; 34 | \sbmin = max(-\nt, -\nt-\sa); 35 | \sbmax = min(\nt, \nt-\sa); 36 | for \sb in {\sbmin,...,\sbmax}{ 37 | coordinate \oo; 38 | \oo = (70.89339464913091+\ang0:9.16515138991168*\sa*\lb/2) 39 | + (10.893394649130906+\ang0:9.16515138991168*\sb*\lb/2); 40 | int \i; 41 | for \i in {0,1,2,3,4,5}{ 42 | \angr = 60*\i+\ang0; 43 | \a1 = 0+\angr; 44 | \a2 = 60+\angr; 45 | \a3 = 120+\angr; 46 | \a4 = 180+\angr; 47 | { 48 | \draw[bonda] (\oo) coordinate (oo) coordinate (oo a\sa b\sb) -- 49 | ++(\a1:\la) coordinate (pa \i) coordinate (pa \i a\sa b\sb) 50 | ++ (\a2:\lb) coordinate (pb \i) coordinate (pb \i a\sa b\sb) 51 | ++ (\a3:\lb) coordinate (pc \i) coordinate (pc \i a\sa b\sb) 52 | ++ (\a4:\lb) coordinate (pd \i) coordinate (pd \i a\sa b\sb); 53 | }; 54 | }; 55 | { 56 | 57 | % \draw (pa 0) -- (pb 0) -- (pc 0) -- (pd 0); 58 | % \draw (pa 1) -- (pb 1) -- (pc 1) -- (pd 1); 59 | % \draw (pa 2) -- (pb 2) -- (pc 2); 60 | % \draw (pc 5) -- (pa 0); 61 | \draw[bondb] (pa 0) -- (pb 0); 62 | \draw[bondc] (pb 0) -- (pc 0); 63 | \draw[bondc] (pc 0) -- (pd 0); 64 | \draw[bondb] (pa 1) -- (pb 1); 65 | \draw[bondc] (pb 1) -- (pc 1); 66 | \draw[bondc] (pc 1) -- (pd 1); 67 | \draw[bondb] (pa 2) -- (pb 2); 68 | \draw[bondc] (pb 2) -- (pc 2); 69 | \draw[bondc] (pc 5) -- (pa 0); 70 | }; 71 | if (\sb==\sbmin) then { 72 | { 73 | \draw (pc 2)[bondc] -- (pd 2); 74 | \draw (pd 2)[bondb] -- (pb 3); 75 | \draw (pb 3)[bondc] -- (pc 3); 76 | }; 77 | }; 78 | if \sa<1 then { 79 | if (\sb==\sbmin || \sa==-\nt then { 80 | { 81 | \draw[bondc] (pc 3) -- (pd 3); 82 | \draw[bondb] (pd 3) -- (pb 4); 83 | \draw[bondc] (pb 4) -- (pc 4); 84 | }; 85 | }; 86 | if (\sb==\sbmax || \sa==-\nt then { 87 | { 88 | \draw[bondc] (pc 4) -- (pd 4); 89 | \draw[bondb] (pd 4) -- (pb 5); 90 | \draw[bondc] (pb 5) -- (pc 5); 91 | }; 92 | }; 93 | }; 94 | { 95 | \draw[fill=red] (oo) circle [radius=1.5pt]; 96 | \draw[fill=red] (pa 0) circle [radius=1.5pt]; 97 | \draw[fill=red] (pa 1) circle [radius=1.5pt]; 98 | \draw[fill=red] (pa 2) circle [radius=1.5pt]; 99 | \draw[fill=red] (pa 3) circle [radius=1.5pt]; 100 | \draw[fill=red] (pa 4) circle [radius=1.5pt]; 101 | \draw[fill=red] (pa 5) circle [radius=1.5pt]; 102 | 103 | \draw[fill=red] (pb 0) circle [radius=1.5pt]; 104 | \draw[fill=red] (pb 1) circle [radius=1.5pt]; 105 | \draw[fill=red] (pb 2) circle [radius=1.5pt]; 106 | \draw[fill=red] (pb 3) circle [radius=1.5pt]; 107 | \draw[fill=red] (pb 4) circle [radius=1.5pt]; 108 | \draw[fill=red] (pb 5) circle [radius=1.5pt]; 109 | 110 | \draw[fill=red] (pc 0) circle [radius=1.5pt]; 111 | \draw[fill=red] (pc 1) circle [radius=1.5pt]; 112 | \draw[fill=red] (pc 2) circle [radius=1.5pt]; 113 | \draw[fill=red] (pc 3) circle [radius=1.5pt]; 114 | \draw[fill=red] (pc 4) circle [radius=1.5pt]; 115 | \draw[fill=red] (pc 5) circle [radius=1.5pt]; 116 | }; 117 | }; 118 | }; 119 | { 120 | \tikzset{ucirc/.style={fill=blue}} 121 | \begin{pgfonlayer}{v2} 122 | % \draw[line width=1pt,-stealth] (oo a0b0) -> (oo a0b1); 123 | % \draw[line width=1pt,-stealth] (oo a0b0) -> (oo a1b0); 124 | % \draw[line width=1pt,dashed,gray] (oo a0b1) -> (oo a1b1); 125 | % \draw[line width=1pt,dashed,gray] (oo a1b0) -> (oo a1b1); 126 | \end{pgfonlayer}{v2} 127 | % \draw[ucirc] (oo a0b0) circle [radius=1.5pt]; 128 | % \draw[ucirc] (pb 0a0b0) circle [radius=1.5pt]; 129 | % \draw[ucirc] (pc 0a0b0) circle [radius=1.5pt]; 130 | % \draw[ucirc] (pd 0a0b0) circle [radius=1.5pt]; 131 | 132 | % \draw[ucirc] (pb 1a0b1) circle [radius=1.5pt]; 133 | % \draw[ucirc] (pc 1a0b1) circle [radius=1.5pt]; 134 | % \draw[ucirc] (pd 1a0b1) circle [radius=1.5pt]; 135 | 136 | % \draw[ucirc] (pa 5a1b0) circle [radius=1.5pt]; 137 | % \draw[ucirc] (pd 5a1b0) circle [radius=1.5pt]; 138 | }; 139 | { 140 | % \node at (3,-1) {$v_1 = \frac{a}{2}\mqty(3\\5\sqrt{3})$}; 141 | % \node at (6,-1) {$v_2 = \frac{a}{2}\mqty(9\\\sqrt{3})$}; 142 | }; 143 | } 144 | \end{tikzpicture} 145 | 146 | \end{document} 147 | 148 | %%% Local Variables: 149 | %%% mode: latex 150 | %%% TeX-master: t 151 | %%% End: 152 | -------------------------------------------------------------------------------- /docs/source/images/honeycomb_structure.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{shapes.geometric,patterns,positioning,matrix} 9 | \usetikzlibrary{shadows,calc,3d,arrows.meta,decorations.pathmorphing,decorations.markings,decorations.pathreplacing} 10 | 11 | \definecolor{googleB}{HTML}{4285F4} 12 | \definecolor{googleG}{HTML}{34A853} 13 | \definecolor{googleY}{HTML}{FBBC05} 14 | \definecolor{googleR}{HTML}{EA4335} 15 | \definecolor{googleBG}{HTML}{3B96A4} 16 | 17 | % load TikZ grafic definitions 18 | %\input{gfx_TikZ} 19 | 20 | % main document 21 | \begin{document} 22 | \begin{tikzpicture} 23 | 24 | \def\colorX{googleG} 25 | \def\colorY{googleR} 26 | \def\colorZ{googleB} 27 | 28 | \begin{scope}[shift = {(+1.5, +1.5)}] 29 | \foreach \x in {-2, +2} { 30 | \draw[thick, \colorZ, shift = {(\x, 0)}, rotate = 45] (-{sqrt(2)/2 - 0.15}, 0) to (0, 0); 31 | \draw[thick, \colorZ, shift = {(\x, 0)}, rotate = 45, dotted] (0, 0) to (+{sqrt(2)/4}, 0); 32 | } 33 | % \foreach \x in {-4, 0, +4} { 34 | % \draw[thick, gray, shift = {(\x, 0)}, rotate = 45, dotted] (-{sqrt(2)/2 - 0.15}, 0) to (+{sqrt(2)/4}, 0); 35 | % } 36 | \end{scope} 37 | 38 | \begin{scope}[shift = {(+1, +1)}] 39 | \begin{scope}[shift = {(-4, 0)}] 40 | \draw[thick, \colorY, dotted] (-1.0, 0) to (-0.5, 0); 41 | \draw[thick, \colorY] (-0.5, 0) to (-0.0, 0); 42 | \end{scope} 43 | \foreach \x in {-3, +1} { 44 | \draw[thick, \colorX, shift = {(\x, 0)}] (-0.85, 0) to (+0.85, 0); 45 | \draw[thick, gray, dotted, shift = {(\x, 0)}] (-1.75, -0.25) to (+1.25, -0.25) to (+1.75, +0.25) to (-1.25, +0.25) -- cycle; 46 | } 47 | \foreach \x in {-1, +3} { 48 | \draw[thick, \colorY, shift = {(\x, 0)}] (-0.85, 0) to (+0.85, 0); 49 | } 50 | \begin{scope}[shift = {(+4, 0)}] 51 | \draw[thick, \colorX] (+0.0, 0) to (+0.5, 0); 52 | \draw[thick, \colorX, dotted] (+0.5, 0) to (+1.0, 0); 53 | \end{scope} 54 | 55 | \foreach \x in {-4, 0, +4} { 56 | \draw[thick] (\x,0) to (\x, -0.5); 57 | \draw[thick, black, fill = white] (\x, 0) circle (0.15); 58 | } 59 | \foreach \x in {-2, +2} { 60 | \draw[thick] (\x,0) to (\x, -0.5); 61 | \draw[thick, black, fill = black] (\x, 0) circle (0.15); 62 | } 63 | \end{scope} 64 | 65 | \begin{scope}[shift = {(+0.5, +0.5)}] 66 | \foreach \x in {-4, 0, +4} { 67 | \draw[thick, \colorZ, shift = {(\x, 0)}, rotate = 45] (-{sqrt(2)/2 - 0.15}, 0) to (+{sqrt(2)/2 - 0.15}, 0); 68 | } 69 | % \foreach \x in {-2, +2} { 70 | % \draw[thick, gray, shift = {(\x, 0)}, rotate = 45, dotted] (-{sqrt(2)/2 - 0.15}, 0) to (+{sqrt(2)/2 - 0.15}, 0); 71 | % } 72 | \end{scope} 73 | 74 | \begin{scope}[shift = {(0, 0)}] 75 | \begin{scope}[shift = {(-4, 0)}] 76 | \draw[thick, \colorX, dotted] (-1.0, 0) to (-0.5, 0); 77 | \draw[thick, \colorX] (-0.5, 0) to (-0.0, 0); 78 | \end{scope} 79 | \foreach \x in {-1, +3} { 80 | \draw[thick, \colorX, shift = {(\x, 0)}] (-0.85, 0) to (+0.85, 0); 81 | \draw[thick, gray, dotted, shift = {(\x, 0)}] (-1.75, -0.25) to (+1.25, -0.25) to (+1.75, +0.25) to (-1.25, +0.25) -- cycle; 82 | } 83 | \foreach \x in {-3, +1} { 84 | \draw[thick, \colorY, shift = {(\x, 0)}] (-0.85, 0) to (+0.85, 0); 85 | } 86 | \begin{scope}[shift = {(+4, 0)}] 87 | \draw[thick, \colorY] (+0.0, 0) to (+0.5, 0); 88 | \draw[thick, \colorY, dotted] (+0.5, 0) to (+1.0, 0); 89 | \end{scope} 90 | 91 | \foreach \x in {-2, +2} { 92 | \draw[thick] (\x,0) to (\x, -0.5); 93 | \draw[thick, black, fill = white] (\x, 0) circle (0.15); 94 | } 95 | \foreach \x in {-4, 0, +4} { 96 | \draw[thick] (\x,0) to (\x, -0.5); 97 | \draw[thick, black, fill = black] (\x, 0) circle (0.15); 98 | } 99 | \end{scope} 100 | 101 | \begin{scope}[shift = {(-0.5, -0.5)}] 102 | \foreach \x in {-2, +2} { 103 | \draw[thick, \colorZ, shift = {(\x, 0)}, rotate = 45] (-{sqrt(2)/2 - 0.15}, 0) to (+{sqrt(2)/2 - 0.15}, 0); 104 | } 105 | % \foreach \x in {-4, 0, +4} { 106 | % \draw[thick, gray, shift = {(\x, 0)}, rotate = 45, dotted] (-{sqrt(2)/2 - 0.15}, 0) to (+{sqrt(2)/2 - 0.15}, 0); 107 | % } 108 | \end{scope} 109 | 110 | \begin{scope}[shift = {(-1, -1)}] 111 | \begin{scope}[shift = {(-4, 0)}] 112 | \draw[thick, \colorY, dotted] (-1.0, 0) to (-0.5, 0); 113 | \draw[thick, \colorY] (-0.5, 0) to (-0.0, 0); 114 | \end{scope} 115 | \foreach \x in {-3, +1} { 116 | \draw[thick, \colorX, shift = {(\x, 0)}] (-0.85, 0) to (+0.85, 0); 117 | \draw[thick, gray, dotted, shift = {(\x, 0)}] (-1.75, -0.25) to (+1.25, -0.25) to (+1.75, +0.25) to (-1.25, +0.25) -- cycle; 118 | } 119 | \foreach \x in {-1, +3} { 120 | \draw[thick, \colorY, shift = {(\x, 0)}] (-1.0, 0) to (+1.0, 0); 121 | } 122 | \begin{scope}[shift = {(+4, 0)}] 123 | \draw[thick, \colorX] (+0.0, 0) to (+0.5, 0); 124 | \draw[thick, \colorX, dotted] (+0.5, 0) to (+1.0, 0); 125 | \end{scope} 126 | 127 | \foreach \x in {-4, 0, +4} { 128 | \draw[thick] (\x,0) to (\x, -0.5); 129 | \draw[thick, black, fill = white] (\x, 0) circle (0.15); 130 | } 131 | \foreach \x in {-2, +2} { 132 | \draw[thick] (\x,0) to (\x, -0.5); 133 | \draw[thick, black, fill = black] (\x, 0) circle (0.15); 134 | } 135 | \end{scope} 136 | 137 | \begin{scope}[shift = {(-1.5, -1.5)}] 138 | \foreach \x in {-4, 0, +4} { 139 | \draw[thick, \colorZ, shift = {(\x, 0)}, rotate = 45] (0, 0) to (+{sqrt(2)/2 - 0.15}, 0); 140 | \draw[thick, \colorZ, shift = {(\x, 0)}, rotate = 45, dotted] (0, 0) to (-{sqrt(2)/4}, 0); 141 | } 142 | % \foreach \x in {-2, +2} { 143 | % \draw[thick, gray, shift = {(\x, 0)}, rotate = 45, dotted] (-{sqrt(2)/4}, 0) to (+{sqrt(2)/2 - 0.15}, 0); 144 | % } 145 | \end{scope} 146 | 147 | \node at (+7.0, +0.5) {{\color{\colorX}$x$}-link}; 148 | \node at (+6.5, +0.0) {{\color{\colorY}$y$}-link}; 149 | \node at (+6.0, -0.5) {{\color{\colorZ}$z$}-link}; 150 | 151 | 152 | \end{tikzpicture} 153 | 154 | \end{document} 155 | 156 | %%% Local Variables: 157 | %%% mode: latex 158 | %%% TeX-master: t 159 | %%% End: 160 | -------------------------------------------------------------------------------- /varipeps/expectation/structure_factor.py: -------------------------------------------------------------------------------- 1 | from functools import partial 2 | 3 | import jax.numpy as jnp 4 | from jax import jit 5 | 6 | from varipeps.peps import PEPS_Tensor, PEPS_Unit_Cell 7 | from varipeps.contractions import apply_contraction_jitted 8 | 9 | from typing import Sequence 10 | 11 | 12 | @partial(jit, static_argnums=(4, 5)) 13 | def calc_structure_factor_expectation( 14 | peps_tensor_obj: PEPS_Tensor, 15 | alpha_gate: jnp.ndarray, 16 | beta_gate: jnp.array, 17 | structure_factor_inner_factors: Sequence[float], 18 | real_d: int, 19 | num_sites: int, 20 | ): 21 | if num_sites > 1: 22 | Id = jnp.eye(real_d ** (num_sites - 1)) 23 | 24 | full_alpha_gate = [jnp.kron(alpha_gate, Id)] 25 | 26 | alpha_gate_tmp = full_alpha_gate[0].reshape((real_d,) * 2 * num_sites) 27 | for i in range(1, num_sites): 28 | trans_order = list(range(1, num_sites)) + list( 29 | range(num_sites + 1, 2 * num_sites) 30 | ) 31 | trans_order.insert(i, 0) 32 | trans_order.insert(num_sites + i, num_sites) 33 | 34 | tmp_gate = alpha_gate_tmp.transpose(trans_order).reshape( 35 | real_d**num_sites, real_d**num_sites 36 | ) 37 | 38 | full_alpha_gate.append(tmp_gate * structure_factor_inner_factors[i].conj()) 39 | 40 | alpha_beta_gate = 0 41 | # alpha_beta_gate_tmp_1 = alpha_beta_gate.reshape((real_d,) * 2 * num_sites) 42 | alpha_beta_gate_tmp_2 = jnp.kron( 43 | jnp.kron(alpha_gate, beta_gate), jnp.eye(real_d ** (num_sites - 2)) 44 | ).reshape((real_d,) * 2 * num_sites) 45 | 46 | for i in range(num_sites): 47 | for j in range(num_sites): 48 | if i == j: 49 | continue 50 | 51 | # if i == j: 52 | # trans_order = list(range(1, num_sites)) + list( 53 | # range(num_sites + 1, 2 * num_sites) 54 | # ) 55 | # trans_order.insert(i, 0) 56 | # trans_order.insert(num_sites + i, num_sites) 57 | # 58 | # tmp_gate = alpha_beta_gate_tmp_1.transpose(trans_order) 59 | # tmp_gate = tmp_gate.reshape(real_d**num_sites, real_d**num_sites) 60 | # 61 | # alpha_beta_gate += tmp_gate 62 | # else: 63 | trans_order = list(range(2, num_sites)) + list( 64 | range(num_sites + 2, 2 * num_sites) 65 | ) 66 | if i <= j: 67 | trans_order.insert(i, 0) 68 | trans_order.insert(j, 1) 69 | trans_order.insert(num_sites + i, num_sites) 70 | trans_order.insert(num_sites + j, num_sites + 1) 71 | else: 72 | trans_order.insert(j, 1) 73 | trans_order.insert(i, 0) 74 | trans_order.insert(num_sites + j, num_sites + 1) 75 | trans_order.insert(num_sites + i, num_sites) 76 | 77 | tmp_gate = alpha_beta_gate_tmp_2.transpose(trans_order) 78 | tmp_gate = tmp_gate.reshape(real_d**num_sites, real_d**num_sites) 79 | 80 | alpha_beta_gate += ( 81 | tmp_gate 82 | * structure_factor_inner_factors[i].conj() 83 | * structure_factor_inner_factors[j] 84 | ) 85 | else: 86 | full_alpha_gate = [alpha_gate] 87 | alpha_beta_gate = alpha_gate @ beta_gate 88 | 89 | density_matrix = apply_contraction_jitted( 90 | "density_matrix_one_site", [peps_tensor_obj.tensor], [peps_tensor_obj], [] 91 | ) 92 | 93 | norm = jnp.trace(density_matrix) 94 | 95 | result = jnp.tensordot(density_matrix, alpha_beta_gate, ((0, 1), (0, 1))) / norm 96 | 97 | density_matrix = apply_contraction_jitted( 98 | "density_matrix_one_site_C1_phase", 99 | [peps_tensor_obj.tensor], 100 | [peps_tensor_obj], 101 | [], 102 | ) 103 | 104 | for g in full_alpha_gate: 105 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 106 | 107 | density_matrix = apply_contraction_jitted( 108 | "density_matrix_one_site_C2_phase", 109 | [peps_tensor_obj.tensor], 110 | [peps_tensor_obj], 111 | [], 112 | ) 113 | 114 | for g in full_alpha_gate: 115 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 116 | 117 | density_matrix = apply_contraction_jitted( 118 | "density_matrix_one_site_C3_phase", 119 | [peps_tensor_obj.tensor], 120 | [peps_tensor_obj], 121 | [], 122 | ) 123 | 124 | for g in full_alpha_gate: 125 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 126 | 127 | density_matrix = apply_contraction_jitted( 128 | "density_matrix_one_site_C4_phase", 129 | [peps_tensor_obj.tensor], 130 | [peps_tensor_obj], 131 | [], 132 | ) 133 | 134 | for g in full_alpha_gate: 135 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 136 | 137 | density_matrix = apply_contraction_jitted( 138 | "density_matrix_one_site_T1_phase", 139 | [peps_tensor_obj.tensor], 140 | [peps_tensor_obj], 141 | [], 142 | ) 143 | 144 | for g in full_alpha_gate: 145 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 146 | 147 | density_matrix = apply_contraction_jitted( 148 | "density_matrix_one_site_T2_phase", 149 | [peps_tensor_obj.tensor], 150 | [peps_tensor_obj], 151 | [], 152 | ) 153 | 154 | for g in full_alpha_gate: 155 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 156 | 157 | density_matrix = apply_contraction_jitted( 158 | "density_matrix_one_site_T3_phase", 159 | [peps_tensor_obj.tensor], 160 | [peps_tensor_obj], 161 | [], 162 | ) 163 | 164 | for g in full_alpha_gate: 165 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 166 | 167 | density_matrix = apply_contraction_jitted( 168 | "density_matrix_one_site_T4_phase", 169 | [peps_tensor_obj.tensor], 170 | [peps_tensor_obj], 171 | [], 172 | ) 173 | 174 | for g in full_alpha_gate: 175 | result += jnp.tensordot(density_matrix, g, ((0, 1), (0, 1))) / norm 176 | 177 | return result 178 | -------------------------------------------------------------------------------- /varipeps/optimization/basinhopping.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from os import PathLike 3 | 4 | import numpy 5 | import scipy.optimize as spo 6 | 7 | import jax.numpy as jnp 8 | from jax.flatten_util import ravel_pytree 9 | 10 | from varipeps import varipeps_config, varipeps_global_state 11 | from varipeps.peps import PEPS_Unit_Cell 12 | from varipeps.expectation import Expectation_Model 13 | from varipeps.mapping import Map_To_PEPS_Model 14 | from varipeps.ctmrg import CTMRGNotConvergedError, CTMRGGradientNotConvergedError 15 | 16 | from .line_search import NoSuitableStepSizeError 17 | from .optimizer import optimize_peps_network, autosave_function 18 | 19 | from typing import List, Union, Tuple, cast, Sequence, Callable, Optional 20 | 21 | 22 | @dataclass 23 | class VariPEPS_Basinhopping: 24 | """ 25 | Class to wrap the basinhopping algorithm for the variational update 26 | of PEPS or mapped structures. 27 | 28 | The parameters of the class initialization are the same as for 29 | :obj:`~varipeps.optimization.optimize_peps_network`. 30 | 31 | Args: 32 | initial_guess (:obj:`~varipeps.peps.PEPS_Unit_Cell` or :term:`sequence` of :obj:`jax.numpy.ndarray`): 33 | The PEPS unitcell to work on or the tensors which should be mapped by 34 | `convert_to_unitcell_func` to a PEPS unitcell. 35 | expectation_func (:obj:`~varipeps.expectation.Expectation_Model`): 36 | Callable to calculate one expectation value which is used as loss 37 | loss function of the model. Likely the function to calculate the energy. 38 | convert_to_unitcell_func (:obj:`~varipeps.mapping.Map_To_PEPS_Model`): 39 | Function to convert the `input_tensors` to a PEPS unitcell. If ommited, 40 | it is assumed that a PEPS unitcell is the first input parameter. 41 | autosave_filename (:obj:`os.PathLike`): 42 | Filename where intermediate results are automatically saved. 43 | autosave_func (:term:`callable`): 44 | Function which is called to autosave the intermediate results. 45 | The function has to accept the arguments `(filename, tensors, unitcell)`.data (:obj:`Unit_Cell_Data`): 46 | Instance of unit cell data class 47 | """ 48 | 49 | initial_guess: Union[PEPS_Unit_Cell, Sequence[jnp.ndarray]] 50 | expectation_func: Expectation_Model 51 | convert_to_unitcell_func: Optional[Map_To_PEPS_Model] = None 52 | autosave_filename: PathLike = "data/autosave.hdf5" 53 | autosave_func: Callable[[PathLike, Sequence[jnp.ndarray], PEPS_Unit_Cell], None] = ( 54 | autosave_function 55 | ) 56 | 57 | def __post_init__(self): 58 | if isinstance(self.initial_guess, PEPS_Unit_Cell): 59 | initial_guess_tensors = [ 60 | i.tensor for i in self.initial_guess.get_unique_tensors() 61 | ] 62 | else: 63 | initial_guess_tensors = list(self.initial_guess) 64 | 65 | initial_guess_flatten_tensors, self._map_pytree_func = ravel_pytree( 66 | initial_guess_tensors 67 | ) 68 | 69 | initial_guess_tensors_numpy = numpy.asarray(initial_guess_flatten_tensors) 70 | 71 | if numpy.iscomplexobj(initial_guess_tensors_numpy): 72 | self._initial_guess_tensors_numpy = numpy.concatenate( 73 | ( 74 | numpy.real(initial_guess_tensors_numpy), 75 | numpy.imag(initial_guess_tensors_numpy), 76 | ) 77 | ) 78 | self._iscomplex = True 79 | self._initial_guess_complex_length = initial_guess_flatten_tensors.size 80 | else: 81 | self._initial_guess_tensors_numpy = initial_guess_tensors_numpy 82 | self._iscomplex = False 83 | 84 | def _wrapper_own_optimizer( 85 | self, 86 | fun, 87 | x0, 88 | *args, 89 | **kwargs, 90 | ): 91 | varipeps_global_state.basinhopping_disable_half_projector = not self._first_step 92 | 93 | if self._iscomplex: 94 | x0_jax = jnp.asarray( 95 | x0[: self._initial_guess_complex_length] 96 | + 1j * x0[self._initial_guess_complex_length :] 97 | ) 98 | else: 99 | x0_jax = jnp.asarray(x0) 100 | x0_jax = self._map_pytree_func(x0_jax) 101 | 102 | if isinstance(self.initial_guess, PEPS_Unit_Cell): 103 | input_obj = PEPS_Unit_Cell.from_tensor_list( 104 | x0_jax, self.initial_guess.data.structure 105 | ) 106 | else: 107 | input_obj = x0_jax 108 | 109 | opt_result = optimize_peps_network( 110 | input_obj, 111 | self.expectation_func, 112 | self.convert_to_unitcell_func, 113 | self.autosave_filename, 114 | self.autosave_func, 115 | ) 116 | 117 | result_tensors, _ = ravel_pytree(opt_result.x) 118 | result_tensors_numpy = numpy.asarray(result_tensors) 119 | if self._iscomplex: 120 | result_tensors_numpy = numpy.concatenate( 121 | (numpy.real(result_tensors_numpy), numpy.imag(result_tensors_numpy)) 122 | ) 123 | 124 | opt_result["x"] = result_tensors_numpy 125 | if opt_result.fun is not None: 126 | opt_result["fun"] = numpy.asarray(opt_result.fun) 127 | else: 128 | opt_result["fun"] = numpy.inf 129 | 130 | self._first_step = False 131 | 132 | return opt_result 133 | 134 | @staticmethod 135 | def _dummy_func(x, *args, **kwargs): 136 | return x 137 | 138 | def run(self) -> spo.OptimizeResult: 139 | """ 140 | Run the basinhopping algorithm for the setup initialized in the class 141 | object. 142 | 143 | For details see :obj:`scipy.optimize.basinhopping`. 144 | 145 | Returns: 146 | :obj:`scipy.optimize.OptimizeResult`: 147 | Result from the basinhopping algorithm with additional fields 148 | ``unitcell`` and ``result_tensors`` for the result tensors and 149 | unitcell in the normal format of this library. 150 | """ 151 | self._first_step = True 152 | 153 | result = spo.basinhopping( 154 | self._dummy_func, 155 | self._initial_guess_tensors_numpy, 156 | niter=varipeps_config.basinhopping_niter, 157 | T=varipeps_config.basinhopping_T, 158 | niter_success=varipeps_config.basinhopping_niter_success, 159 | disp=True, 160 | minimizer_kwargs={"method": self._wrapper_own_optimizer}, 161 | ) 162 | 163 | result["unitcell"] = result.lowest_optimization_result.unitcell 164 | 165 | if self._iscomplex: 166 | x_jax = jnp.asarray( 167 | result.x[: self._initial_guess_complex_length] 168 | + 1j * result.x[self._initial_guess_complex_length :] 169 | ) 170 | else: 171 | x_jax = jnp.asarray(result.x) 172 | x_jax = self._map_pytree_func(x_jax) 173 | 174 | result["result_tensors"] = x_jax 175 | 176 | varipeps_global_state.basinhopping_disable_half_projector = None 177 | 178 | return result 179 | -------------------------------------------------------------------------------- /docs/source/images/floret_pentagon_structure.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | 3 | \usepackage{amsfonts} 4 | \usepackage{amsmath} 5 | \usepackage{braket} 6 | 7 | \usepackage{tikz} 8 | \usetikzlibrary{math, calc, decorations, positioning} 9 | 10 | % load TikZ grafic definitions 11 | %\input{gfx_TikZ} 12 | 13 | % main document 14 | \begin{document} 15 | 16 | \pgfdeclarelayer{v1} % background layer 17 | \pgfdeclarelayer{v2} % foreground layer 18 | \pgfsetlayers{v1,main,v2} % set the order of the layers (main is the standard layer) 19 | \tikzset{ 20 | bonda/.style={black}, 21 | bondb/.style={black}, 22 | bondc/.style={black}} 23 | \tikzset{sitenode/.style={fill=red, draw, circle, inner sep=1pt}} 24 | \tikzset{llegs/.style={gray, dashed, thin}} 25 | \tikzset{cggroup/.style={ 26 | draw, dashed, shape=circle, 27 | minimum size=32pt, 28 | line width=.6pt, 29 | fill=black!80!white, 30 | fill opacity=.1,}} 31 | 32 | \tikzset{cgnode/.style={ 33 | draw, shape=circle, 34 | minimum size=12pt, 35 | line width=.6pt, 36 | fill=black, 37 | fill opacity=.6,}} 38 | 39 | \tikzset{middlenode/.style={ 40 | draw, 41 | minimum size=12pt, 42 | line width=.6pt, 43 | fill=red, 44 | fill opacity=.6}} 45 | \begin{tikzpicture} 46 | \tikzmath { 47 | \ang0 = 0; 48 | \lb = 0.5; 49 | \la = 2*\lb; 50 | int \sa; 51 | int \sb; 52 | int \samin; 53 | int \samax; 54 | \samin = -1; 55 | \samax = 1; 56 | function gsbmin(\fsa) { 57 | return max(\samin, \samin-\fsa); 58 | % return -\nt; 59 | % return -1; 60 | }; 61 | function gsbmax(\fsa) { 62 | return min(\samax, \samax-\fsa); 63 | % return \samax; 64 | }; 65 | function ispart(\fa, \fb){ 66 | return (\fa<=\samax && \fa>=\samin && 67 | \fb<=gsbmax(\fa) && \fb>=gsbmin(\fa)); 68 | }; 69 | for \sa in {\samin,...,\samax}{ 70 | int \sbmin, \sbmax; 71 | \sbmin = gsbmin(\sa); 72 | \sbmax = gsbmax(\sa); 73 | for \sb in {\sbmin,...,\sbmax}{ 74 | int \sbp, \sbm, \sap, \sam; 75 | \sbp = \sb + 1; 76 | \sbm = \sb - 1; 77 | \sap = \sa + 1; 78 | \sam = \sa - 1; 79 | coordinate \oo; 80 | \oo = (70.89339464913091+\ang0:9.16515138991168*\sa*\lb/2) 81 | + (10.893394649130906+\ang0:9.16515138991168*\sb*\lb/2); 82 | int \i; 83 | for \i in {0,1,2,3,4,5}{ 84 | \angr = 60*\i+\ang0; 85 | \a1 = 0+\angr; 86 | \a2 = 60+\angr; 87 | \a3 = 120+\angr; 88 | \a4 = 180+\angr; 89 | { 90 | \draw[bonda] (\oo) coordinate (oo) coordinate (oo a\sa b\sb) -- 91 | ++(\a1:\la) coordinate (pa \i) coordinate (pa \i a\sa b\sb) 92 | ++ (\a2:\lb) coordinate (pb \i) coordinate (pb \i a\sa b\sb) 93 | ++ (\a3:\lb) coordinate (pc \i) coordinate (pc \i a\sa b\sb) 94 | ++ (\a4:\lb) coordinate (pd \i) coordinate (pd \i a\sa b\sb); 95 | }; 96 | }; 97 | { 98 | \begin{pgfonlayer}{v1} 99 | \draw[bonda] (pa 0) -- (pb 0) -- (pc 0) -- (pd 0); 100 | \draw[bonda] (pa 1) -- (pb 1) -- (pc 1) -- (pd 1); 101 | \draw[bonda] (pa 2) -- (pb 2) -- (pc 2); 102 | \draw[bonda] (pc 5) -- (pa 0); 103 | \end{pgfonlayer} 104 | }; 105 | if (!ispart(\sa, \sb-1)) then { 106 | { 107 | \draw[bonda] (pc 2) -- (pd 2) -- (pb 3) -- (pc 3); 108 | }; 109 | }; 110 | if (!ispart(\sa-1, \sb)) then { 111 | { 112 | \draw[bonda] (pc 3) -- (pd 3) -- (pb 4) -- (pc 4); 113 | }; 114 | }; 115 | if (!ispart(\sa-1, \sb+1)) then { 116 | { 117 | \draw[bonda] (pc 4) -- (pd 4) -- (pb 5) -- (pc 5); 118 | }; 119 | }; 120 | { 121 | \node[sitenode,name=noo a\sa b\sb] at (oo) {}; 122 | 123 | \node[sitenode,name=npa 0a\sa b\sb] at (pa 0) {}; 124 | \node[sitenode,name=npa 1a\sa b\sb] at (pa 1) {}; 125 | \node[sitenode,name=npa 2a\sa b\sb] at (pa 2) {}; 126 | \node[sitenode,name=npa 3a\sa b\sb] at (pa 3) {}; 127 | \node[sitenode,name=npa 4a\sa b\sb] at (pa 4) {}; 128 | \node[sitenode,name=npa 5a\sa b\sb] at (pa 5) {}; 129 | 130 | \node[sitenode,name=npb 0a\sa b\sb] at (pb 0) {}; 131 | \node[sitenode,name=npb 1a\sa b\sb] at (pb 1) {}; 132 | \node[sitenode,name=npb 2a\sa b\sb] at (pb 2) {}; 133 | \node[sitenode,name=npb 3a\sa b\sb] at (pb 3) {}; 134 | \node[sitenode,name=npb 4a\sa b\sb] at (pb 4) {}; 135 | \node[sitenode,name=npb 5a\sa b\sb] at (pb 5) {}; 136 | 137 | \node[sitenode,name=npc 0a\sa b\sb] at (pc 0) {}; 138 | \node[sitenode,name=npc 1a\sa b\sb] at (pc 1) {}; 139 | \node[sitenode,name=npc 2a\sa b\sb] at (pc 2) {}; 140 | \node[sitenode,name=npc 3a\sa b\sb] at (pc 3) {}; 141 | \node[sitenode,name=npc 4a\sa b\sb] at (pc 4) {}; 142 | \node[sitenode,name=npc 5a\sa b\sb] at (pc 5) {}; 143 | }; 144 | }; 145 | }; 146 | for \sa in {\samin,...,\samax}{ 147 | int \sbmin, \sbmax; 148 | \sbmin = gsbmin(\sa); 149 | \sbmax = gsbmax(\sa); 150 | for \sb in {\sbmin,...,\sbmax}{ 151 | int \sbp, \sbm, \sap, \sam; 152 | \sbp = \sb + 1; 153 | \sbm = \sb - 1; 154 | \sap = \sa + 1; 155 | \sam = \sa - 1; 156 | int \i; 157 | for \i in {0,1,2,3,4,5}{ 158 | \angr = 60*\i+\ang0; 159 | \a1 = 0+\angr; 160 | \a2 = 60+\angr; 161 | \a3 = 120+\angr; 162 | \a4 = 180+\angr; 163 | { 164 | \path (oo a\sa b\sb) coordinate (oo) 165 | ++(\a1:\la) coordinate (pa \i) coordinate (pa \i a\sa b\sb) 166 | ++ (\a2:\lb) coordinate (pb \i) coordinate (pb \i a\sa b\sb) 167 | ++ (\a3:\lb) coordinate (pc \i) coordinate (pc \i a\sa b\sb) 168 | ++ (\a4:\lb) coordinate (pd \i) coordinate (pd \i a\sa b\sb); 169 | }; 170 | }; 171 | }; 172 | }; 173 | { 174 | \tikzset{ucirc/.style={sitenode, fill=blue}}; 175 | \begin{pgfonlayer}{v2} 176 | \draw[line width=1pt,dashed,gray] (oo a0b1) -> (oo a-1b1); 177 | \draw[line width=1pt,dashed,gray] (oo a-1b0) -> (oo a-1b1); 178 | \draw[line width=.75pt,-stealth] (oo a0b0) -> (oo a0b1) node[midway, label=110:$v_2$] {}; 179 | \draw[line width=.75pt,-stealth] (oo a0b0) -> (oo a-1b0) node[midway, label=110:$v_1$] {}; 180 | 181 | \node[ucirc, label={\small 1}] at (oo a0b0) {}; 182 | \node[ucirc, label=200:{\small 2}] at (pa 0a0b0) {}; 183 | \node[ucirc, label={\small 3}] at (pa 5a0b0) {}; 184 | \node[ucirc, label={\small 4}] at (pc 5a0b0) {}; 185 | \node[ucirc, label={\small 6}] at (pb 5a0b0) {}; 186 | \node[ucirc, label={\small 5}] at (pa 4a0b1) {}; 187 | \node[ucirc, label={\small 7}] at (pc 4a0b0) {}; 188 | \node[ucirc, label={\small 9}] at (pb 4a0b0) {}; 189 | \node[ucirc, label={\small 8}] at (pb 0a-1b0) {}; 190 | \end{pgfonlayer}{v2} 191 | }; 192 | } 193 | \end{tikzpicture} 194 | 195 | \end{document} 196 | 197 | %%% Local Variables: 198 | %%% mode: latex 199 | %%% TeX-master: t 200 | %%% End: 201 | --------------------------------------------------------------------------------