ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
special_mpos.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * ALPS MPS DMRG Project
4  *
5  * Copyright (C) 2013 Institute for Theoretical Physics, ETH Zurich
6  * 2011-2011 by Bela Bauer <bauerb@phys.ethz.ch>
7  *
8  * This software is part of the ALPS Applications, published under the ALPS
9  * Application License; you can use, redistribute it and/or modify it under
10  * the terms of the license, either version 1 or (at your option) any later
11  * version.
12  *
13  * You should have received a copy of the ALPS Application License along with
14  * the ALPS Applications; see the file LICENSE.txt. If not, the license is also
15  * available from http://alps.comp-phys.org/.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  *
25  *****************************************************************************/
26 
27 #ifndef SPECIAL_MPOS_H
28 #define SPECIAL_MPOS_H
29 
30 #include "dmrg/mp_tensors/mpo.h"
31 
32 template<class Matrix, class SymmGroup>
34 {
36  for (std::size_t k = 0; k < phys_i.size(); ++k)
37  ret.insert_block(Matrix(phys_i[k].second, phys_i[k].second),
38  phys_i[k].first, phys_i[k].first);
39  ret *= 0;
40  return ret;
41 }
42 
43 template<class Matrix, class SymmGroup>
45 {
46  typedef typename Index<SymmGroup>::basis_iterator bit;
47 
49  mpo(0,0) = make_mpo_identity_block<Matrix>(phys_i);
50 
51  for (bit up = phys_i.basis_begin(); !up.end(); ++up)
52  mpo(0, 0, *up, *up) = 1;
53 
54  return mpo;
55 }
56 
57 template<class Matrix>
59 {
61 
63  mpo(0,0) = make_mpo_identity_block<Matrix>(phys_i);
64 
65  int s = 1;
66  for (bit up = phys_i.basis_begin(); !up.end(); ++up, s *= -1)
67  mpo(0, 0, *up, *up) = s;
68 
69  return mpo;
70 }
71 
72 template<class Matrix>
73 MPO<Matrix, TrivialGroup> s12_ising(std::size_t L, double J, double h)
74 {
75  J *= 0.25;
76  h *= 0.5;
77 
78  Index<TrivialGroup> phys_i; phys_i.insert(std::make_pair(TrivialGroup::Plus, 2));
79  Index<TrivialGroup> triv; triv.insert(std::make_pair(TrivialGroup::Plus, 1));
80  Index<TrivialGroup> aux; aux.insert(std::make_pair(TrivialGroup::Plus, 4));
81 
82  MPOTensor<Matrix, TrivialGroup> bulk(4, 4), left(1, 4), right(4, 1);
83 
84  bulk(0, 0) = make_mpo_identity_block<Matrix>(phys_i);
85  bulk(1, 1) = make_mpo_identity_block<Matrix>(phys_i);
86  bulk(3, 3) = make_mpo_identity_block<Matrix>(phys_i);
87  bulk(0, 1) = make_mpo_identity_block<Matrix>(phys_i);
88  bulk(0, 2) = make_mpo_identity_block<Matrix>(phys_i);
89  bulk(2, 3) = make_mpo_identity_block<Matrix>(phys_i);
90 
91  left(0, 0) = make_mpo_identity_block<Matrix>(phys_i);
92  left(0, 1) = make_mpo_identity_block<Matrix>(phys_i);
93  left(0, 2) = make_mpo_identity_block<Matrix>(phys_i);
94 
95  right(0, 0) = make_mpo_identity_block<Matrix>(phys_i);
96  right(1, 0) = make_mpo_identity_block<Matrix>(phys_i);
97  right(2, 0) = make_mpo_identity_block<Matrix>(phys_i);
98  right(3, 0) = make_mpo_identity_block<Matrix>(phys_i);
99 
100 #define NGI(v) std::make_pair(TrivialGroup::Plus, v)
101 
102  for (int k = 0; k < 2; ++k) {
103  bulk(0, 0, NGI(k), NGI(k)) = 1;
104  bulk(1, 1, NGI(k), NGI(k)) = 1;
105  bulk(3, 3, NGI(k), NGI(k)) = 1;
106  }
107 
108  // Sz
109 
110  bulk(0, 1, NGI(0), NGI(0)) = h;
111  bulk(0, 1, NGI(1), NGI(1)) = -h;
112  // flip 1
113  bulk(0, 2, NGI(0), NGI(1)) = J;
114  bulk(0, 2, NGI(1), NGI(0)) = J;
115  // flip 2
116  bulk(2, 3, NGI(0), NGI(1)) = 1;
117  bulk(2, 3, NGI(1), NGI(0)) = 1;
118 
119  left(0, 0, NGI(0), NGI(0)) = 1;
120  left(0, 0, NGI(1), NGI(1)) = 1;
121  left(0, 1, NGI(0), NGI(0)) = h;
122  left(0, 1, NGI(1), NGI(1)) = -h;
123  left(0, 2, NGI(0), NGI(1)) = J;
124  left(0, 2, NGI(1), NGI(0)) = J;
125 
126  right(0, 0, NGI(0), NGI(0)) = h;
127  right(0, 0, NGI(1), NGI(1)) = -h;
128  right(2, 0, NGI(0), NGI(1)) = 1;
129  right(2, 0, NGI(1), NGI(0)) = 1;
130  for (int k = 0; k < 2; ++k) {
131  right(1, 0, NGI(k), NGI(k)) = 1;
132  right(3, 0, NGI(k), NGI(k)) = 1;
133  }
134 
135 #undef NGI
136 
137  MPO<Matrix, TrivialGroup> ret(L, bulk);
138  ret[0] = left;
139  ret[L-1] = right;
140  return ret;
141 }
142 
143 template<class Matrix>
144 MPO<Matrix, U1> s12_heisenberg(std::size_t L, double Jxy, double Jz)
145 {
146  Index<U1> phys;
147  phys.insert(std::make_pair(1, 1));
148  phys.insert(std::make_pair(-1, 1));
149 
150  block_matrix<Matrix, U1> ident, splus, sminus, sz, zero;
151 
152  ident.insert_block(boost::tuples::make_tuple(Matrix(1, 1, 1), -1, -1));
153  ident.insert_block(boost::tuples::make_tuple(Matrix(1, 1, 1), 1, 1));
154 
155  splus.insert_block(boost::tuples::make_tuple(Matrix(1, 1, 1), -1, 1));
156 
157  sminus.insert_block(boost::tuples::make_tuple(Matrix(1, 1, 1), 1, -1));
158 
159  sz.insert_block(boost::tuples::make_tuple(Matrix(1, 1, 0.5), 1, 1));
160  sz.insert_block(boost::tuples::make_tuple(Matrix(1, 1, -0.5), -1, -1));
161 
162  MPOTensor<Matrix, U1> bulk(5, 5);
163  bulk(0,0) = ident;
164  bulk(0,1) = Jxy/2*splus;
165  bulk(1,3) = sminus;
166  bulk(0,2) = Jxy/2*sminus;
167  bulk(2,3) = splus;
168  bulk(3,3) = ident;
169  bulk(0,4) = Jz*sz;
170  bulk(4,3) = sz;
171 
172  MPOTensor<Matrix, U1> left(1, 5);
173  left(0,0) = ident;
174  left(0,1) = Jxy/2*splus;
175  left(0,2) = Jxy/2*sminus;
176  left(0,4) = Jz*sz;
177 
178  MPOTensor<Matrix, U1> right(5, 1);
179  right(1,0) = sminus;
180  right(2,0) = splus;
181  right(3,0) = ident;
182  right(4,0) = sz;
183 
184  MPO<Matrix, U1> ret(L, bulk);
185  ret[0] = left;
186  ret[L-1] = right;
187 
188  return ret;
189 }
190 
191 #endif
MPOTensor< Matrix, SymmGroup > identity_mpo(Index< SymmGroup > phys_i)
Definition: special_mpos.h:44
bool end() const
basis_iterator basis_begin() const
size_type insert_block(Matrix const &, charge, charge)
Definition: mpo.h:36
definition of MPO class (vector of MPOTensor)
MPOTensor< Matrix, TrivialGroup > s12_sz_mpo(Index< TrivialGroup > phys_i)
Definition: special_mpos.h:58
#define NGI(v)
MPO< Matrix, TrivialGroup > s12_ising(std::size_t L, double J, double h)
Definition: special_mpos.h:73
std::size_t insert(std::pair< charge, std::size_t > const &x)
std::size_t size() const
block_matrix< Matrix, SymmGroup > make_mpo_identity_block(Index< SymmGroup > phys_i)
Definition: special_mpos.h:33
MPO< Matrix, U1 > s12_heisenberg(std::size_t L, double Jxy, double Jz)
Definition: special_mpos.h:144