8const static tuple<int,double>
optTEBDstep (
double tmax,
double dtmax,
double tol_accu=0.05)
10 double dt3 = pow(tol_accu/tmax,0.5);
11 double dt9 = pow(tol_accu/tmax,0.25);
17 double cost3 = tmax/dt3*3;
18 double cost9 = tmax/dt9*9;
21 tuple<int,double> out;
22 get<0>(out) = (cost9<cost3)? 9 : 3;
23 get<1>(out) = (cost9<cost3)? dt9 : dt3;
29template<
typename Hamiltonian,
size_t Nq,
typename TimeScalar,
typename VectorType>
70template<
typename Hamiltonian,
size_t Nq,
typename TimeScalar,
typename VectorType>
73:tstep(0.), CHOSEN_VERBOSITY(VERBOSITY)
76template<
typename Hamiltonian,
size_t Nq,
typename TimeScalar,
typename VectorType>
78t_step (
const Hamiltonian &H,
const VectorType &Vin, VectorType &Vout, TimeScalar dt,
double tol,
int Nexp,
TEBD_EXCEPTION EX)
80 assert(Nexp==2 or Nexp==3 or Nexp==5 or Nexp==9 or Nexp==11 and
"Implemented orders: 2,3,5,9,11");
88 GateEvn1 = H.BondPropagator(tstep,
EVEN);
89 GateOdd1 = H.BondPropagator(tstep,
ODD);
90 GateEvn1Double = H.BondPropagator(2.*tstep,
EVEN);
91 GateOdd1Double = H.BondPropagator(2.*tstep,
ODD);
96 GateEvn1 = H.BondPropagator(0.5*tstep,
EVEN);
97 GateOdd1 = H.BondPropagator(tstep,
ODD);
98 GateEvn1Double = H.BondPropagator(tstep,
EVEN);
104 double y = pow(2.*sqrt(326.)-36.,1./3.);
105 double xEvn1 = (y*y+6.*y-2.)/(12.*y);
106 double xEvn2 = 1.-2.*xEvn1;
108 GateEvn1 = H.BondPropagator(xEvn1*tstep,
EVEN);
109 GateOdd1 = H.BondPropagator(xOdd1*tstep,
ODD);
110 GateEvn2 = H.BondPropagator(xEvn2*tstep,
EVEN);
111 GateEvn1Double = H.BondPropagator(2.*xEvn1*tstep,
EVEN);
116 double xEvn1 = (642.+sqrt(471.))/3924.;
117 double xEvn2 = 121./3924.*(12.-sqrt(471.));
118 double xEvn3 = 1.-2.*(xEvn1+xEvn2);
119 double xOdd1 = 6./11.;
120 double xOdd2 = -1./22.;
122 GateEvn1 = H.BondPropagator(xEvn1*tstep,
EVEN);
123 GateOdd1 = H.BondPropagator(xOdd1*tstep,
ODD);
124 GateEvn2 = H.BondPropagator(xEvn2*tstep,
EVEN);
125 GateOdd2 = H.BondPropagator(xOdd2*tstep,
ODD);
126 GateEvn3 = H.BondPropagator(xEvn3*tstep,
EVEN);
127 GateEvn1Double = H.BondPropagator(2.*xEvn1*tstep,
EVEN);
140 double xEvn1 = (14.-sqrt(19.))/108.;
141 double xEvn2 = (20.-7.*sqrt(19.))/108.;
142 double xEvn3 = 0.5-xEvn1-xEvn2;
147 GateEvn1 = H.BondPropagator(xEvn1*tstep,
EVEN);
148 GateOdd1 = H.BondPropagator(xOdd1*tstep,
ODD);
149 GateEvn2 = H.BondPropagator(xEvn2*tstep,
EVEN);
150 GateOdd2 = H.BondPropagator(xOdd2*tstep,
ODD);
151 GateEvn3 = H.BondPropagator(xEvn3*tstep,
EVEN);
152 GateOdd3 = H.BondPropagator(xOdd3*tstep,
ODD);
153 GateEvn1Double = H.BondPropagator(2.*xEvn1*tstep,
EVEN);
160 VectorType Vtmp1, Vtmp2;
162 auto apply_gate = [
this,&Compadre,&tol,&Nexp] (
const Mpo<Nq,TimeScalar> &Gate,
const VectorType &Vin, VectorType &Vout,
int i,
PARITY P)
164 Compadre.varCompress(Gate, Vin, Vout, Vin.calc_Dmax(), tol);
167 string p = (P==
EVEN)?
"EVEN " :
"ODD ";
168 lout << p << i+1 <<
"/" << Nexp <<
": " << Compadre.
info() << endl;
174 apply_gate(GateEvn1,Vin, Vtmp1, 0,
EVEN);
175 apply_gate(GateOdd1,Vtmp1,Vout, 1,
ODD);
182 else {apply_gate(GateEvn1Double,Vin, Vtmp1, 0,
EVEN);}
183 apply_gate(GateOdd1,Vtmp1,Vtmp2, 1,
ODD);
185 else {apply_gate(GateEvn1Double,Vtmp2, Vout, 2,
EVEN);}
189 apply_gate(GateOdd1,Vin,Vtmp1, 1,
ODD);
190 apply_gate(GateEvn1,Vtmp1,Vout, 2,
EVEN);
194 apply_gate(GateEvn1,Vin, Vtmp1, 1,
EVEN);
195 apply_gate(GateOdd1,Vtmp1,Vout, 2,
ODD);
200 apply_gate(GateEvn1,Vin, Vtmp1, 0,
EVEN);
201 apply_gate(GateOdd1,Vtmp1,Vtmp2, 1,
ODD);
202 apply_gate(GateEvn2,Vtmp2,Vtmp1, 2,
EVEN);
203 apply_gate(GateOdd1,Vtmp1,Vtmp2, 3,
ODD);
204 apply_gate(GateEvn1,Vtmp2,Vout, 4,
EVEN);
208 apply_gate(GateEvn1,Vin, Vtmp1, 0,
EVEN);
209 apply_gate(GateOdd1,Vtmp1,Vtmp2, 1,
ODD);
210 apply_gate(GateEvn2,Vtmp2,Vtmp1, 2,
EVEN);
211 apply_gate(GateOdd2,Vtmp1,Vtmp2, 3,
ODD);
212 apply_gate(GateEvn2,Vtmp2,Vtmp1, 4,
EVEN);
213 apply_gate(GateOdd1,Vtmp1,Vtmp2, 5,
ODD);
214 apply_gate(GateEvn1,Vtmp2,Vout, 6,
EVEN);
221 else {apply_gate(GateEvn1Double,Vin, Vtmp1, 0,
EVEN);}
222 apply_gate(GateOdd1,Vtmp1,Vtmp2, 1,
ODD);
223 apply_gate(GateEvn2,Vtmp2,Vtmp1, 2,
EVEN);
224 apply_gate(GateOdd2,Vtmp1,Vtmp2, 3,
ODD);
225 apply_gate(GateEvn3,Vtmp2,Vtmp1, 4,
EVEN);
226 apply_gate(GateOdd2,Vtmp1,Vtmp2, 5,
ODD);
227 apply_gate(GateEvn2,Vtmp2,Vtmp1, 6,
EVEN);
228 apply_gate(GateOdd1,Vtmp1,Vtmp2, 7,
ODD);
230 else {apply_gate(GateEvn1Double,Vtmp2, Vout, 8,
EVEN);}
234 apply_gate(GateOdd1,Vin, Vtmp2, 1,
ODD);
235 apply_gate(GateEvn2,Vtmp2,Vtmp1, 2,
EVEN);
236 apply_gate(GateOdd2,Vtmp1,Vtmp2, 3,
ODD);
237 apply_gate(GateEvn3,Vtmp2,Vtmp1, 4,
EVEN);
238 apply_gate(GateOdd2,Vtmp1,Vtmp2, 5,
ODD);
239 apply_gate(GateEvn2,Vtmp2,Vtmp1, 6,
EVEN);
240 apply_gate(GateOdd1,Vtmp1,Vtmp2, 7,
ODD);
241 apply_gate(GateEvn1,Vtmp2,Vout, 8,
EVEN);
245 apply_gate(GateEvn1,Vin, Vtmp1, 1,
EVEN);
246 apply_gate(GateOdd1,Vtmp1,Vtmp2, 2,
ODD);
247 apply_gate(GateEvn2,Vtmp2,Vtmp1, 3,
EVEN);
248 apply_gate(GateOdd2,Vtmp1,Vtmp2, 4,
ODD);
249 apply_gate(GateEvn3,Vtmp2,Vtmp1, 5,
EVEN);
250 apply_gate(GateOdd2,Vtmp1,Vtmp2, 6,
ODD);
251 apply_gate(GateEvn2,Vtmp2,Vtmp1, 7,
EVEN);
252 apply_gate(GateOdd1,Vtmp1,Vout, 8,
ODD);
270 apply_gate(GateEvn1,Vin, Vtmp1, 0,
EVEN);
271 apply_gate(GateOdd1,Vtmp1,Vtmp2, 1,
ODD);
272 apply_gate(GateEvn2,Vtmp2,Vtmp1, 2,
EVEN);
273 apply_gate(GateOdd2,Vtmp1,Vtmp2, 3,
ODD);
274 apply_gate(GateEvn3,Vtmp2,Vtmp1, 4,
EVEN);
275 apply_gate(GateOdd3,Vtmp1,Vtmp2, 5,
ODD);
276 apply_gate(GateEvn3,Vtmp2,Vtmp1, 6,
EVEN);
277 apply_gate(GateOdd2,Vtmp1,Vtmp2, 7,
ODD);
278 apply_gate(GateEvn2,Vtmp2,Vtmp1, 8,
EVEN);
279 apply_gate(GateOdd1,Vtmp1,Vtmp2, 9,
ODD);
280 apply_gate(GateEvn1,Vtmp2,Vout, 10,
EVEN);
285 lout << Chronos.info(
"exp(-i*H*dt)*V") << endl;
286 lout <<
"Vout: " << Vout.info() << endl;
static const tuple< int, double > optTEBDstep(double tmax, double dtmax, double tol_accu=0.05)
TEBDPropagator(DMRG::VERBOSITY::OPTION VERBOSITY=DMRG::VERBOSITY::SILENT)
Mpo< Nq, TimeScalar > GateEvn3
void t_step(const Hamiltonian &H, const VectorType &Vin, VectorType &Vout, TimeScalar dt, double tol=1e-5, int Nexp=3, TEBD_EXCEPTION EX=NO_EXCEPTION)
Mpo< Nq, TimeScalar > GateEvn1Double
Mpo< Nq, TimeScalar > GateOdd2
Mpo< Nq, TimeScalar > GateEvn1
Mpo< Nq, TimeScalar > GateOdd1Double
Mpo< Nq, TimeScalar > GateOdd3
Mpo< Nq, TimeScalar > GateOdd1
DMRG::VERBOSITY::OPTION CHOSEN_VERBOSITY
Mpo< Nq, TimeScalar > GateEvn2