-
Notifications
You must be signed in to change notification settings - Fork 123
/
clock.py
79 lines (61 loc) · 2.73 KB
/
clock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""Quantum Clock model.
Generalization of transverse field Ising model to higher dimensional on-site Hilbert space.
"""
# Copyright (C) TeNPy Developers, GNU GPLv3
import numpy as np
from .model import CouplingMPOModel, NearestNeighborModel
from .lattice import Chain
from ..networks.site import ClockSite
__all__ = ['ClockModel', 'ClockChain']
class ClockModel(CouplingMPOModel):
r"""q-state Quantum clock model on a general lattice
The Hamiltonian reads:
.. math ::
H = - \sum_{\langle i,j\rangle, i < j} \mathtt{J} (X_i X_j^\dagger + \mathrm{ h.c.})
- \sum_{i} \mathtt{g} (Z_i + \mathrm{ h.c.})
Here, :math:`\langle i,j \rangle, i< j` denotes nearest neighbor pairs, each pair appearing
exactly once.
The operators :math:`X_i` and :math:`Z_i` are :math:`N \times N` generalizations of
the Pauli X and Z operators, see :class:`~tenpy.networks.site.ClockSite`.
All parameters are collected in a single dictionary `model_params`, which
is turned into a :class:`~tenpy.tools.params.Config` object.
Parameters
----------
model_params : :class:`~tenpy.tools.params.Config`
Parameters for the model. See :cfg:config:`ClockModel` below.
Options
-------
.. cfg:config :: ClockModel
:include: CouplingMPOModel
conserve : None | 'Z'
What should be conserved. See :class:`~tenpy.networks.Site.ClockSite`.
sort_charge : bool
Whether to sort by charges of physical legs. `True` by default.
q : int
The number of states per site.
J, g : float | array
Couplings as defined for the Hamiltonian above.
"""
def init_sites(self, model_params):
conserve = model_params.get('conserve', 'Z')
if conserve == 'best':
conserve = 'Z'
self.logger.info("%s: set conserve to %s", self.name, conserve)
q = model_params.get('q', None)
if q is None:
raise ValueError('Need to specify q.')
sort_charge = model_params.get('sort_charge', True)
return ClockSite(q=q, conserve=conserve, sort_charge=sort_charge)
def init_terms(self, model_params):
J = np.asarray(model_params.get('J', 1.))
g = np.asarray(model_params.get('g', 1.))
for u in range(len(self.lat.unit_cell)):
self.add_onsite(-g, u, 'Z', plus_hc=True)
for u1, u2, dx in self.lat.pairs['nearest_neighbors']:
self.add_coupling(-J, u1, 'X', u2, 'Xhc', dx, plus_hc=True)
class ClockChain(ClockModel, NearestNeighborModel):
"""The :class:`ClockModel` on a Chain, suitable for TEBD.
See the :class:`ClockModel` for the documentation of parameters.
"""
default_lattice = Chain
force_default_lattice = True