ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
ChainLattice Class Reference

#include <lattice.hpp>

Inheritance diagram for ChainLattice:
lattice_impl

Public Types

typedef lattice_impl::pos_t pos_t
 

Public Member Functions

 ChainLattice (BaseParameters &parms, bool pbc_=false)
 
 ChainLattice (int L_, bool pbc_=false, double a_=1.)
 
std::vector< pos_tforward (pos_t i) const
 
std::vector< pos_tall (pos_t i) const
 
boost::any get_prop_ (std::string const &property, std::vector< pos_t > const &pos) const
 
pos_t size () const
 
int maximum_vertex_type () const
 
template<class T >
get_prop (std::string property, pos_t site) const
 
template<class T >
get_prop (std::string property, pos_t bond1, pos_t bond2) const
 
template<class T >
get_prop (std::string property, std::vector< pos_t > const &positions) const
 

Detailed Description

Definition at line 41 of file lattice.hpp.

Member Typedef Documentation

Definition at line 44 of file lattice.hpp.

Constructor & Destructor Documentation

ChainLattice::ChainLattice ( BaseParameters parms,
bool  pbc_ = false 
)
inline

Definition at line 46 of file lattice.hpp.

47  : L(parms["L"])
48  , a(parms["a"])
49  , pbc(pbc_)
50  { }
ChainLattice::ChainLattice ( int  L_,
bool  pbc_ = false,
double  a_ = 1. 
)
inline

Definition at line 52 of file lattice.hpp.

53  : L(L_)
54  , a(a_)
55  , pbc(pbc_)
56  { }

Member Function Documentation

std::vector<pos_t> ChainLattice::all ( pos_t  i) const
inlinevirtual

Implements lattice_impl.

Definition at line 67 of file lattice.hpp.

68  {
69  std::vector<pos_t> ret;
70  if (i < L-1)
71  ret.push_back(i+1);
72  if (i > 0)
73  ret.push_back(i-1);
74  if (pbc && i == L-1)
75  ret.push_back(0);
76  if (pbc && i == 0)
77  ret.push_back(L-1);
78  return ret;
79  }
std::vector<pos_t> ChainLattice::forward ( pos_t  i) const
inlinevirtual

Implements lattice_impl.

Definition at line 58 of file lattice.hpp.

59  {
60  std::vector<pos_t> ret;
61  if (i < L-1)
62  ret.push_back(i+1);
63  if (pbc && i == L-1)
64  ret.push_back(0);
65  return ret;
66  }
template<class T >
T lattice_impl::get_prop ( std::string  property,
pos_t  site 
) const
inlineinherited

Definition at line 49 of file lattice.h.

51  {
52  return boost::any_cast<T>(get_prop_(property, std::vector<pos_t>(1, site)));
53  }
virtual boost::any get_prop_(std::string const &, std::vector< pos_t > const &) const =0
template<class T >
T lattice_impl::get_prop ( std::string  property,
pos_t  bond1,
pos_t  bond2 
) const
inlineinherited

Definition at line 55 of file lattice.h.

57  {
58  std::vector<pos_t> v(2);
59  v[0] = bond1; v[1] = bond2;
60  return boost::any_cast<T>(get_prop_(property, v));
61  }
virtual boost::any get_prop_(std::string const &, std::vector< pos_t > const &) const =0
template<class T >
T lattice_impl::get_prop ( std::string  property,
std::vector< pos_t > const &  positions 
) const
inlineinherited

Definition at line 63 of file lattice.h.

65  {
66  return boost::any_cast<T>(get_prop_(property, positions));
67  }
virtual boost::any get_prop_(std::string const &, std::vector< pos_t > const &) const =0
boost::any ChainLattice::get_prop_ ( std::string const &  property,
std::vector< pos_t > const &  pos 
) const
inlinevirtual

Implements lattice_impl.

Definition at line 81 of file lattice.hpp.

82  {
83  if (property == "label" && pos.size() == 1)
84  return boost::any( site_label(pos[0]) );
85  else if (property == "label" && pos.size() == 2)
86  return boost::any( bond_label(pos[0], pos[1]) );
87  else if (property == "type" && pos.size() == 1)
88  return boost::any( 0 );
89  else if (property == "type" && pos.size() == 2)
90  return boost::any( 0 );
91  else if (property == "x" && pos.size() == 1)
92  return boost::any( a * pos[0] );
93  else if (property == "at_open_boundary" && pos.size() == 1)
94  return boost::any( (!pbc) && (pos[0]==0 || pos[0]==L-1) );
95  else if (property == "at_open_left_boundary" && pos.size() == 1)
96  return boost::any( (!pbc) && pos[0]==0 );
97  else if (property == "at_open_right_boundary" && pos.size() == 1)
98  return boost::any( (!pbc) && pos[0]==L-1 );
99  else if (property == "wraps_pbc" && pos.size() == 2)
100  return boost::any( (pos[0] < pos[1]) );
101  else {
102  std::ostringstream ss;
103  ss << "No property '" << property << "' with " << pos.size() << " points implemented.";
104  throw std::runtime_error(ss.str());
105  return boost::any();
106  }
107  }
int ChainLattice::maximum_vertex_type ( ) const
inlinevirtual

Implements lattice_impl.

Definition at line 114 of file lattice.hpp.

115  {
116  return 0;
117  }
pos_t ChainLattice::size ( ) const
inlinevirtual

Implements lattice_impl.

Definition at line 109 of file lattice.hpp.

110  {
111  return L;
112  }

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