ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
exp_mpo_maker< Matrix, SymmGroup > Class Template Reference

#include <te_utils.hpp>

Public Member Functions

 exp_mpo_maker (Index< SymmGroup > phys1_, Index< SymmGroup > phys2_, std::size_t pos1_, std::size_t pos2_, Lattice const &lat_)
 
void add_term (term_t const &term, Model< Matrix, SymmGroup > const &model)
 
MPO< Matrix, SymmGroup > exp_mpo (typename Matrix::value_type const &alpha, std::vector< tag_type > const &ident, std::vector< tag_type > const &fill, op_table_ptr op_table) const
 

Detailed Description

template<class Matrix, class SymmGroup>
class exp_mpo_maker< Matrix, SymmGroup >

Definition at line 171 of file te_utils.hpp.

Constructor & Destructor Documentation

template<class Matrix , class SymmGroup >
exp_mpo_maker< Matrix, SymmGroup >::exp_mpo_maker ( Index< SymmGroup >  phys1_,
Index< SymmGroup >  phys2_,
std::size_t  pos1_,
std::size_t  pos2_,
Lattice const &  lat_ 
)
inline

Definition at line 184 of file te_utils.hpp.

186  : phys1(phys1_), phys2(phys2_)
187  , pos1(pos1_), pos2(pos2_), L(pos2-pos1+1)
188  , lattice(lat_)
189  , type1(lattice.get_prop<int>("type", pos1))
190  , type2(lattice.get_prop<int>("type", pos2))
191  , n_boso(0), n_ferm(0)
192  { }
T get_prop(std::string property, pos_t site) const
Definition: lattice.h:103

Member Function Documentation

template<class Matrix , class SymmGroup >
void exp_mpo_maker< Matrix, SymmGroup >::add_term ( term_t const &  term,
Model< Matrix, SymmGroup > const &  model 
)
inline

Definition at line 194 of file te_utils.hpp.

195  {
196  if (term.size() > 2)
197  throw std::runtime_error("time evolution requires at max two-site bond term.");
198 
199  op_table_ptr op_table = model.operators_table()->get_operator_table();
200 
201  /// kron product of operators
202  op_t bond_op;
203  if (term.size() == 2)
204  op_kron(model.phys_dim(type1), model.phys_dim(type2), (*op_table)[term.operator_tag(0)], (*op_table)[term.operator_tag(1)], bond_op);
205  else if (term.position(0) == pos1)
206  op_kron(model.phys_dim(type1), model.phys_dim(type2), (*op_table)[term.operator_tag(0)], model.identity_matrix(type2), bond_op);
207  else if (term.position(0) == pos2)
208  op_kron(model.phys_dim(type1), model.phys_dim(type2), model.identity_matrix(type1), (*op_table)[term.operator_tag(0)], bond_op);
209  else
210  throw std::runtime_error("Operator k not matching any valid position.");
211 
212  if (term.is_fermionic) {
213  fermionic_bond += term.coeff * bond_op;
214  n_ferm += 1;
215  } else {
216  bosonic_bond += term.coeff * bond_op;
217  n_boso += 1;
218  }
219  }
op_t const & identity_matrix(size_t type=0) const
Definition: model.h:124
void op_kron(Index< SymmGroup > const &phys_A, Index< SymmGroup > const &phys_B, block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix1, SymmGroup > const &B, block_matrix< Matrix2, SymmGroup > &C)
table_ptr operators_table() const
Definition: model.h:137
Index< SymmGroup > const & phys_dim(size_t type=0) const
Definition: model.h:123
template<class Matrix , class SymmGroup >
MPO<Matrix, SymmGroup> exp_mpo_maker< Matrix, SymmGroup >::exp_mpo ( typename Matrix::value_type const &  alpha,
std::vector< tag_type > const &  ident,
std::vector< tag_type > const &  fill,
op_table_ptr  op_table 
) const
inline

Definition at line 221 of file te_utils.hpp.

224  {
225  std::size_t maximum_b = 0;
226  prempo_t prempo(L);
227 
228  if (n_boso > 0) {
229  std::vector<op_t> left_ops, right_ops;
230  exp_and_split(bosonic_bond, alpha, left_ops, right_ops);
231 
232  maximum_b = add_to_mpo(prempo, maximum_b, left_ops, right_ops, 1., ident, op_table);
233  }
234 
235  if (n_ferm > 0) {
236  /// exp(alpha * op1 \otimes op2)
237  {
238  std::vector<op_t> left_ops, right_ops;
239  exp_and_split(fermionic_bond, alpha, left_ops, right_ops);
240 
241  maximum_b = add_to_mpo(prempo, maximum_b, left_ops, right_ops, .5, ident, op_table);
242  maximum_b = add_to_mpo(prempo, maximum_b, left_ops, right_ops, .5, fill, op_table);
243  }
244 
245  /// exp(-alpha * op1 \otimes op2)
246  {
247  std::vector<op_t> left_ops, right_ops;
248  exp_and_split(fermionic_bond, -alpha, left_ops, right_ops);
249 
250  maximum_b = add_to_mpo(prempo, maximum_b, left_ops, right_ops, .5, ident, op_table);
251  maximum_b = add_to_mpo(prempo, maximum_b, left_ops, right_ops, -.5, fill, op_table);
252  }
253  }
254 
255 
256  MPO<Matrix, SymmGroup> mpo(L);
257  for (size_t p=0; p<L; ++p) {
258  size_t nrows, ncols;
259  using generate_mpo::rcdim;
260  boost::tie(nrows, ncols) = rcdim(prempo[p]);
261  MPOTensor<Matrix, SymmGroup> tmp(nrows, ncols, prempo[p], op_table);
262  using std::swap;
263  swap(mpo[p], tmp);
264  }
265 
266  return mpo;
267  }
void swap(MPSTensor< Matrix, SymmGroup > &x, MPSTensor< Matrix, SymmGroup > &y)
Definition: mpo.h:36
std::pair< size_t, size_t > rcdim(Vector const &pm)
Definition: utils.hpp:212

The documentation for this class was generated from the following file: