29 #ifndef SUPER_MODELS_NONE_HPP
30 #define SUPER_MODELS_NONE_HPP
71 template<
class Matrix>
75 const size_t N2 = N*N;
79 for(
size_t i = 0; i < N; ++i )
81 for(
size_t j = 0; j < N; ++j )
83 const size_t n = i + j*N;
84 Matrix phi (N,N); phi(i,j) = 1.;
85 Matrix hphi(N,N);
gemm(h,phi,hphi);
86 Matrix phih(N,N);
gemm(phi,h,phih);
87 Matrix comm = hphi - phih;
90 for(
size_t ii = 0; ii < N; ++ii )
91 for(
size_t jj = 0; jj < N; ++jj )
92 adH(ii+jj*N, n) = comm(ii,jj);
102 template<
class Matrix>
106 const size_t N2 = N*N;
110 Matrix ldagl(N,N);
gemm(ldag,l,ldagl);
113 for(
size_t i = 0; i < N; ++i )
115 for(
size_t j = 0; j < N; ++j )
117 const size_t n = i + j*N;
118 Matrix phi (N,N); phi(i,j) = 1.;
121 Matrix lphi (N,N);
gemm(l,phi,lphi);
122 Matrix lphildag(N,N);
gemm(lphi,ldag,lphildag);
123 Matrix ldaglphi(N,N);
gemm(ldag,lphi,ldaglphi);
124 Matrix phildagl(N,N);
gemm(phi,ldagl,phildagl);
125 Matrix ll = 2*lphildag - ldaglphi - phildagl;
128 for(
size_t ii = 0; ii < N; ++ii )
129 for(
size_t jj = 0; jj < N; ++jj )
130 lindL(ii+jj*N, n) = ll(ii,jj);
140 template<
class Matrix>
144 const size_t N2 = N*N;
147 Matrix superL(N2,N2);
149 for(
size_t i = 0; i < N; ++i )
151 for(
size_t j = 0; j < N; ++j )
153 const size_t n = i + j*N;
154 Matrix phi(N,N); phi(i,j) = 1.;
157 Matrix lphi(N,N);
gemm(l,phi,lphi);
158 for(
size_t ii = 0; ii < N; ++ii )
159 for(
size_t jj = 0; jj < N; ++jj )
160 superL(ii+jj*N, n) = lphi(ii,jj);
170 template<
class Matrix>
174 const size_t N2 = N*N;
177 Matrix superL(N2,N2);
179 for(
size_t i = 0; i < N; ++i )
181 for(
size_t j = 0; j < N; ++j )
183 const size_t n = i + j*N;
184 Matrix phi (N,N); phi(i,j) = 1.;
187 Matrix phil(N,N);
gemm(phi,l,phil);
188 for(
size_t ii = 0; ii < N; ++ii )
189 for(
size_t jj = 0; jj < N; ++jj )
190 superL(ii+jj*N, n) = phil(ii,jj);
199 template<
class T,
class A>
204 for( T i = 0; i < ind.size(); ++i )
206 fused += ind[i] * stride;
213 template<
class T,
class A>
216 for( T i = 0; i < ind.size(); ++i )
221 assert( fused == 0 );
227 template<
class Matrix>
230 typedef typename Matrix::size_type size_type;
232 size_type d =
sqrt(
sqrt(
double(d4)));
234 assert( d4 == d*d*d*d );
237 boost::array<size_type,4> ii, jj, kk, ll;
238 for( size_type i = 0; i < d4; ++i )
241 for( size_type j = 0; j < d4; ++j )
244 kk[0] = ii[0]; kk[1] = ii[2]; kk[2] = jj[0]; kk[3] = jj[2];
245 ll[0] = ii[1]; ll[1] = ii[3]; ll[2] = jj[1]; ll[3] = jj[3];
253 template<
class Op,
class Matrix>
259 typename alps::numeric::associated_real_diagonal_matrix<Matrix>::type S, Ssqrt;
268 left.insert_block(tmp, C, C);
273 right.insert_block(tmp, C, C);
278 assert(leftops.size() == rightops.size());
281 std::vector< std::pair<Op,Op> > terms;
282 for(
unsigned i = 0; i < num_rows(S) && std::abs(S(i,i)) > 1e-10; ++i )
284 leftops[i].transpose_inplace();
285 rightops[i].transpose_inplace();
286 terms.push_back(std::pair<Op,Op>( leftops[i], rightops[i] ));
293 template<
class Matrix>
308 typedef typename Matrix::value_type value_type;
317 do_init(lat,model,
typename Matrix::value_type());
322 throw std::runtime_error(
"need complex value type");
328 int Nmax = model[
"Nmax"];
329 double t = model[
"t"];
330 double U = model[
"U"];
331 double mu = model[
"mu"];
332 double omega = model[
"omega"];
333 double V = model[
"V"];
334 double Lambda = model[
"Lambda"];
335 double Delta = model[
"Delta"];
336 double Gamma1a = model[
"Gamma1a"];
337 double Gamma1b = model[
"Gamma1b"];
338 double Gamma2 = model[
"Gamma2"];
339 double nbar = model[
"nbar"];
342 const size_t N = Nmax+1;
343 const size_t N2 = N*N;
344 const std::complex<double> I(0,1);
346 phys_psi.
insert(std::make_pair(C, N));
348 phys.
insert(std::make_pair(C, N2));
352 mcount.resize(N,N); minteraction.resize(N,N); mcreate.resize(N,N); mdestroy.resize(N,N);
353 for(
int n = 1; n <= Nmax; ++n )
357 minteraction(n,n) = n*n-n;
359 mcreate(n,n-1) =
std::sqrt(value_type(n));
360 mdestroy(n-1,n) =
std::sqrt(value_type(n));
362 Matrix mcreate2 (N,N);
gemm(mcreate ,mcreate ,mcreate2 );
363 Matrix mdestroy2(N,N);
gemm(mdestroy,mdestroy,mdestroy2);
392 std::vector< std::pair<op_t,op_t> > hopops = decompose_bond_super<op_t>(
adjoint_hamiltonian(kron(mcreate, mdestroy)),phys);
393 std::vector< std::pair<op_t,op_t> > Vops = decompose_bond_super<op_t>(
adjoint_hamiltonian(kron(mcount, mcount)),phys);
396 #define REGISTER(op, kind) op ## _tag = tag_handler->register_op(op, kind);
410 std::vector< std::pair<tag_type,tag_type> > hopops_tag(hopops.size());
411 for (
size_t i=0; i<hopops.size(); ++i)
412 hopops_tag[i] = std::make_pair( tag_handler->register_op(hopops[i].first,
tag_detail::bosonic),
414 std::vector< std::pair<tag_type,tag_type> > Vops_tag(Vops.size());
415 for (
size_t i=0; i<Vops.size(); ++i)
416 Vops_tag[i] = std::make_pair( tag_handler->register_op(Vops[i].first,
tag_detail::bosonic),
423 for(
int p=0; p < lat.
size(); ++p )
430 term.push_back( boost::make_tuple(p, interaction_tag) );
431 this->
terms_.push_back(term);
436 double x = p - 0.5*lat.
size();
437 double mup = -mu + 0.5*omega*omega*x*x;
442 term.push_back( boost::make_tuple(p, count_tag) );
443 this->
terms_.push_back(term);
451 term.push_back( boost::make_tuple(p, drive_tag) );
452 this->
terms_.push_back(term);
460 term.push_back( boost::make_tuple(p, pump_tag) );
461 this->
terms_.push_back(term);
469 term.
coeff = I*Gamma1a*(1+nbar);
470 term.push_back( boost::make_tuple(p, lindDestroy_tag) );
471 this->
terms_.push_back(term);
477 if( Gamma1a*nbar != 0 )
480 term.
coeff = I*Gamma1a*nbar;
481 term.push_back( boost::make_tuple(p, lindCreate_tag) );
482 this->
terms_.push_back(term);
490 term.
coeff = I*0.5*Gamma2;
491 term.push_back( boost::make_tuple(p, lindDestroy2_tag) );
492 this->
terms_.push_back(term);
496 std::vector<int> neighs = lat.
forward(p);
497 for(
int n = 0; n < neighs.size(); ++n )
500 for(
unsigned i = 0; i < hopops_tag.size(); ++i )
505 term.push_back( boost::make_tuple(p, hopops_tag[i].first) );
506 term.push_back( boost::make_tuple(neighs[n], hopops_tag[i].second) );
507 this->
terms_.push_back(term);
512 term.push_back( boost::make_tuple(p, hopops_tag[i].second) );
513 term.push_back( boost::make_tuple(neighs[n], hopops_tag[i].first) );
514 this->
terms_.push_back(term);
521 for(
unsigned i = 0; i < Vops_tag.size(); ++i )
526 term.push_back( boost::make_tuple(p, Vops_tag[i].first) );
527 term.push_back( boost::make_tuple(neighs[n],Vops_tag[i].second) );
528 this->
terms_.push_back(term);
533 term.push_back( boost::make_tuple(p, Vops_tag[i].second) );
534 term.push_back( boost::make_tuple(neighs[n],Vops_tag[i].first) );
535 this->
terms_.push_back(term);
549 term.
coeff = I*Gamma1b/2.;
550 term.push_back( boost::make_tuple(p, create_tag) );
551 term.push_back( boost::make_tuple(neighs[n], leftDestroy_tag) );
552 this->
terms_.push_back(term);
557 term.
coeff = I*Gamma1b/2.;
558 term.push_back( boost::make_tuple(p, leftDestroy_tag) );
559 term.push_back( boost::make_tuple(neighs[n], create_tag) );
560 this->
terms_.push_back(term);
565 term.
coeff = -I*Gamma1b/2.;
566 term.push_back( boost::make_tuple(p, destroy_tag) );
567 term.push_back( boost::make_tuple(neighs[n], rightCreate_tag) );
568 this->
terms_.push_back(term);
573 term.
coeff = -I*Gamma1b/2.;
574 term.push_back( boost::make_tuple(p, rightCreate_tag) );
575 term.push_back( boost::make_tuple(neighs[n], destroy_tag) );
576 this->
terms_.push_back(term);
586 throw std::runtime_error(
"update() not yet implemented for this model.");
611 op_t ident_psi = identity_matrix<Matrix>(phys_psi);
612 op_t count_psi, create_psi, destroy_psi;
614 create_psi.insert_block(
transpose(mcreate), C, C);
615 destroy_psi.insert_block(
transpose(mdestroy), C, C);
617 typedef std::vector<block_matrix<Matrix, TrivialGroup> > op_vec;
618 typedef std::vector<std::pair<op_vec, bool> > bond_element;
620 measurements_type meas;
622 if (model[
"MEASURE[Density]"]) {
624 op_vec(1,ident_psi), op_vec(1,ident_psi),
625 op_vec(1,count_psi)) );
626 meas[meas.size()-1].set_super_meas(phys_psi);
629 if (model[
"MEASURE[Local density]"]) {
631 op_vec(1,ident_psi), op_vec(1,ident_psi),
632 op_vec(1,count_psi)) );
633 meas[meas.size()-1].set_super_meas(phys_psi);
636 if (model[
"MEASURE[Local density^2]"]) {
638 gemm(count_psi, count_psi, count2_psi);
640 op_vec(1,ident_psi), op_vec(1,ident_psi),
641 op_vec(1,count2_psi)) );
642 meas[meas.size()-1].set_super_meas(phys_psi);
645 if (model[
"MEASURE[Onebody density matrix]"]) {
647 ops.push_back( std::make_pair(op_vec(1,create_psi),
false) );
648 ops.push_back( std::make_pair(op_vec(1,destroy_psi),
false) );
650 op_vec(1,ident_psi), op_vec(1,ident_psi),
652 meas[meas.size()-1].set_super_meas(phys_psi);
655 if (model[
"MEASURE[Density correlation]"]) {
657 ops.push_back( std::make_pair(op_vec(1,count_psi),
false) );
658 ops.push_back( std::make_pair(op_vec(1,count_psi),
false) );
660 op_vec(1,ident_psi), op_vec(1,ident_psi),
662 meas[meas.size()-1].set_super_meas(phys_psi);
670 throw std::runtime_error(
"Operator not defined for this model.");
684 Matrix mcount, minteraction, mcreate, mdestroy;
685 op_t create, destroy, drive, pump, count, interaction;
686 op_t lindDestroy, lindCreate, lindDestroy2, leftDestroy, rightCreate;
689 boost::shared_ptr<TagHandler<Matrix, TrivialGroup> > tag_handler;
691 tag_type create_tag, destroy_tag, drive_tag, pump_tag, count_tag, interaction_tag;
692 tag_type lindDestroy_tag, lindCreate_tag, lindDestroy2_tag, leftDestroy_tag, rightCreate_tag;
Matrix adjoint_hamiltonian(const Matrix &h)
boost::ptr_vector< measurement< Matrix, TrivialGroup > > measurements_type
void update(BaseParameters const &p)
tag_type get_operator_tag(std::string const &name, size_t type) const
tag_type identity_matrix_tag(size_t type) const
definition of Model base class
block_matrix< Matrix, SymmGroup > identity_matrix(Index< SymmGroup > const &size)
size_type insert_block(Matrix const &, charge, charge)
boost::shared_ptr< table_type > table_ptr
std::vector< block_matrix< Matrix, SymmGroup > > reshape_right_to_list(Index< SymmGroup > const &phys, block_matrix< Matrix, SymmGroup > const &A)
table_type::tag_type tag_type
Matrix super_left(const Matrix &l)
std::vector< term_descriptor > terms_type
std::size_t num_rows(maquis::dmrg::one_matrix< T > const &m)
block_matrix< Matrix, SymmGroup > sqrt(block_matrix< Matrix, SymmGroup > m)
Matrix super_lindblad(const Matrix &l)
std::vector< std::pair< Op, Op > > decompose_bond_super(const Matrix &bondop, const Index< TrivialGroup > &phys)
std::vector< block_matrix< Matrix, SymmGroup > > reshape_left_to_list(Index< SymmGroup > const &phys, block_matrix< Matrix, SymmGroup > const &A)
void do_init(const Lattice &lat, BaseParameters &model_, double)
::term_descriptor< typename Matrix::value_type > term_descriptor
void do_init(const Lattice &lat, BaseParameters &model_, std::complex< double >)
void svd(block_matrix< Matrix, SymmGroup > const &M, block_matrix< Matrix, SymmGroup > &U, block_matrix< Matrix, SymmGroup > &V, block_matrix< DiagMatrix, SymmGroup > &S)
std::size_t num_cols(maquis::dmrg::one_matrix< T > const &m)
table_ptr operators_table() const
measurements_type measurements() const
Matrix reshape_bond2site(const Matrix &a)
static const charge IdentityCharge
#define REGISTER(op, kind)
Matrix super_right(const Matrix &l)
std::vector< pos_t > forward(pos_t site) const
std::size_t insert(std::pair< charge, std::size_t > const &x)
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
block_matrix< typename maquis::traits::transpose_view< Matrix >::type, SymmGroup > transpose(block_matrix< Matrix, SymmGroup > const &m)
TrivialGroup::charge total_quantum_numbers(BaseParameters &parms) const
tag_type filling_matrix_tag(size_t type) const
void unfuse(T fused, T d, A &ind)
SuperBoseHubbardNone(const Lattice &lat, BaseParameters &model_)
Index< TrivialGroup > const & phys_dim(size_t type) const
T fuse(const A &ind, T d)
Fuse indices n[i] into one p = n[i] d^i.