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

#include <models_u1.hpp>

Inheritance diagram for FreeFermions< Matrix >:
model_impl< Matrix, U1 >

Public Types

typedef boost::shared_ptr
< mps_initializer< Matrix, U1 > > 
initializer_ptr
 
typedef std::size_t size_t
 

Public Member Functions

 FreeFermions (const Lattice &lat, double t=1)
 
void update (BaseParameters const &p)
 
Index< U1 > const & phys_dim (size_t type) const
 
tag_type identity_matrix_tag (size_t type) const
 
tag_type filling_matrix_tag (size_t type) const
 
U1::charge total_quantum_numbers (BaseParameters &parms) const
 
tag_type get_operator_tag (std::string const &name, size_t type) const
 
table_ptr operators_table () const
 
measurements_type measurements () const
 
virtual op_t const & identity_matrix (size_t type) const
 
virtual op_t const & filling_matrix (size_t type) const
 
virtual terms_type const & hamiltonian_terms () const
 
virtual op_t const & get_operator (std::string const &name, size_t type) const
 
virtual initializer_ptr initializer (Lattice const &lat, BaseParameters &parms) const
 

Protected Attributes

terms_type terms_
 

Detailed Description

template<class Matrix>
class FreeFermions< Matrix >

Definition at line 492 of file models_u1.hpp.

Member Typedef Documentation

typedef boost::shared_ptr<mps_initializer<Matrix, U1 > > model_impl< Matrix, U1 >::initializer_ptr
inherited

Definition at line 49 of file model.h.

typedef std::size_t model_impl< Matrix, U1 >::size_t
inherited

Definition at line 60 of file model.h.

Constructor & Destructor Documentation

template<class Matrix >
FreeFermions< Matrix >::FreeFermions ( const Lattice lat,
double  t = 1 
)
inline

Definition at line 506 of file models_u1.hpp.

507  : lattice(lat)
508  , tag_handler(new table_type())
509  {
510  op_t ident_op;
511  op_t create_op, destroy_op, sign_op, dens_op;
512 
513  create_op.insert_block(Matrix(1, 1, 1), 0, 1);
514  destroy_op.insert_block(Matrix(1, 1, 1), 1, 0);
515 
516  dens_op.insert_block(Matrix(1, 1, 1), 1, 1);
517 
518  ident_op.insert_block(Matrix(1, 1, 1), 0, 0);
519  ident_op.insert_block(Matrix(1, 1, 1), 1, 1);
520  sign_op.insert_block(Matrix(1, 1, 1), 0, 0);
521  sign_op.insert_block(Matrix(1, 1, -1), 1, 1);
522 
523  phys.insert(std::make_pair(0, 1));
524  phys.insert(std::make_pair(1, 1));
525 
526 #define REGISTER(op, kind) op = tag_handler->register_op(op ## _op, kind);
527 
529  REGISTER(create, tag_detail::fermionic)
530  REGISTER(destroy, tag_detail::fermionic)
531  REGISTER(dens, tag_detail::bosonic)
532  REGISTER(sign, tag_detail::bosonic)
533 
534 #undef REGISTER
535 
536 
537  for (int p=0; p<lat.size(); ++p) {
538  std::vector<int> neighs = lat.forward(p);
539  for (int n=0; n<neighs.size(); ++n) {
540  {
541  term_descriptor term;
542  term.is_fermionic = true;
543  term.coeff = -t;
544  term.push_back( boost::make_tuple(p, create) );
545  term.push_back( boost::make_tuple(neighs[n], destroy) );
546  this->terms_.push_back(term);
547  }
548  {
549  term_descriptor term;
550  term.is_fermionic = true;
551  term.coeff = -t;
552  term.push_back( boost::make_tuple(p, destroy) );
553  term.push_back( boost::make_tuple(neighs[n], create) );
554  this->terms_.push_back(term);
555  }
556  }
557  }
558 
559  }
terms_type terms_
Definition: model.h:85
#define REGISTER(op, kind)
size_type insert_block(Matrix const &, charge, charge)
std::vector< pos_t > forward(pos_t site) const
Definition: lattice.h:100
std::size_t insert(std::pair< charge, std::size_t > const &x)
pos_t size() const
Definition: lattice.h:115

Member Function Documentation

virtual op_t const& model_impl< Matrix, U1 >::filling_matrix ( size_t  type) const
inlinevirtualinherited

Definition at line 69 of file model.h.

69 { return operators_table()->get_op( filling_matrix_tag(type) ); }
virtual table_ptr operators_table() const =0
virtual tag_type filling_matrix_tag(size_t type) const =0
template<class Matrix >
tag_type FreeFermions< Matrix >::filling_matrix_tag ( size_t  type) const
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 576 of file models_u1.hpp.

577  {
578  return sign;
579  }
virtual op_t const& model_impl< Matrix, U1 >::get_operator ( std::string const &  name,
size_t  type 
) const
inlinevirtualinherited

Definition at line 77 of file model.h.

77 { return operators_table()->get_op( get_operator_tag(name, type) ); }
virtual tag_type get_operator_tag(std::string const &name, size_t type) const =0
virtual table_ptr operators_table() const =0
template<class Matrix >
tag_type FreeFermions< Matrix >::get_operator_tag ( std::string const &  name,
size_t  type 
) const
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 585 of file models_u1.hpp.

586  {
587  if (name == "n")
588  return dens;
589  else if (name == "cdag")
590  return create;
591  else if (name == "c")
592  return destroy;
593  else
594  throw std::runtime_error("Operator not valid for this model.");
595  return 0;
596  }
virtual terms_type const& model_impl< Matrix, U1 >::hamiltonian_terms ( ) const
inlinevirtualinherited

Definition at line 74 of file model.h.

74 { return terms_; }
terms_type terms_
Definition: model.h:85
virtual op_t const& model_impl< Matrix, U1 >::identity_matrix ( size_t  type) const
inlinevirtualinherited

Definition at line 67 of file model.h.

67 { return operators_table()->get_op( identity_matrix_tag(type) ); }
virtual table_ptr operators_table() const =0
virtual tag_type identity_matrix_tag(size_t type) const =0
template<class Matrix >
tag_type FreeFermions< Matrix >::identity_matrix_tag ( size_t  type) const
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 572 of file models_u1.hpp.

573  {
574  return ident;
575  }
virtual initializer_ptr model_impl< Matrix, U1 >::initializer ( Lattice const &  lat,
BaseParameters parms 
) const
virtualinherited
template<class Matrix >
measurements_type FreeFermions< Matrix >::measurements ( ) const
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 603 of file models_u1.hpp.

604  {
605  typedef std::vector<block_matrix<Matrix, U1> > op_vec;
606  typedef std::vector<std::pair<op_vec, bool> > bond_element;
607 
608  measurements_type meas;
609  {
610  meas.push_back( new measurements::local<Matrix, U1>("Density", lattice,
611  op_vec(1,this->identity_matrix(0)),
612  op_vec(1,this->filling_matrix(0)),
613  op_vec(1,tag_handler->get_op(dens))) );
614  }
615  {
616  bond_element ops;
617  ops.push_back( std::make_pair(op_vec(1,tag_handler->get_op(dens)), false) );
618  ops.push_back( std::make_pair(op_vec(1,tag_handler->get_op(dens)), false) );
619  meas.push_back( new measurements::correlations<Matrix, U1>("DensityCorrelation", lattice,
620  op_vec(1,this->identity_matrix(0)),
621  op_vec(1,this->filling_matrix(0)),
622  ops, true, false) );
623  }
624  {
625  bond_element ops;
626  ops.push_back( std::make_pair(op_vec(1,tag_handler->get_op(create)), true) );
627  ops.push_back( std::make_pair(op_vec(1,tag_handler->get_op(destroy)), true) );
628  meas.push_back( new measurements::correlations<Matrix, U1>("OneBodyDM", lattice,
629  op_vec(1,this->identity_matrix(0)),
630  op_vec(1,this->filling_matrix(0)),
631  ops, true, false) );
632  }
633  return meas;
634  }
virtual op_t const & identity_matrix(size_t type) const
Definition: model.h:67
virtual op_t const & filling_matrix(size_t type) const
Definition: model.h:69
template<class Matrix >
table_ptr FreeFermions< Matrix >::operators_table ( ) const
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 598 of file models_u1.hpp.

599  {
600  return tag_handler;
601  }
template<class Matrix >
Index<U1> const& FreeFermions< Matrix >::phys_dim ( size_t  type) const
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 568 of file models_u1.hpp.

569  {
570  return phys;
571  }
template<class Matrix >
U1::charge FreeFermions< Matrix >::total_quantum_numbers ( BaseParameters parms) const
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 580 of file models_u1.hpp.

581  {
582  return static_cast<int>(parms["u1_total_charge"]);
583  }
template<class Matrix >
void FreeFermions< Matrix >::update ( BaseParameters const &  p)
inlinevirtual

Implements model_impl< Matrix, U1 >.

Definition at line 561 of file models_u1.hpp.

562  {
563  // TODO: update this->terms_ with the new parameters
564  throw std::runtime_error("update() not yet implemented for this model.");
565  return;
566  }

Member Data Documentation

terms_type model_impl< Matrix, U1 >::terms_
protectedinherited

Definition at line 85 of file model.h.


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