27 #ifndef APP_ALPS_LATTICE_H
28 #define APP_ALPS_LATTICE_H
37 #include <alps/parameter.h>
38 #include <alps/lattice.h>
55 forward_.resize(
size());
56 backward_.resize(
size());
58 for (graph_type::bond_iterator it=graph.bonds().first; it!=graph.bonds().second; ++it) {
59 graph_type::size_type s, t;
60 s = graph.vertex_index(graph.source(*it));
61 t = graph.vertex_index(graph.target(*it));
63 forward_[s].push_back(t);
64 backward_[t].push_back(s);
66 bond_index_map[s][t] = graph.edge_index(*it);
67 bond_index_map[t][s] = graph.edge_index(*it);
77 std::vector<pos_t> ret = forward_[p];
78 std::copy(backward_[p].begin(), backward_[p].end(), std::back_inserter(ret));
84 return graph.num_sites();
89 return alps::maximum_vertex_type(graph.graph());
92 boost::any
get_prop_(std::string
const & property, std::vector<pos_t>
const & pos)
const
94 if (property ==
"label" && pos.size() == 1)
95 return boost::any( alps::site_label(graph.graph(), graph.site(pos[0])) );
96 else if (property ==
"label" && pos.size() == 2)
97 return boost::any( alps::bond_label(graph.graph(), graph.bond(bond_index_map[pos[0]][pos[1]])) );
98 else if (property ==
"type" && pos.size() == 1)
99 return boost::any( static_cast<int>(graph.site_type(graph.site(pos[0]))) );
100 else if (property ==
"type" && pos.size() == 2)
101 return boost::any( static_cast<int>(graph.bond_type(graph.bond(bond_index_map[pos[0]][pos[1]]))) );
102 else if (property ==
"wraps_pbc" && pos.size() == 2)
103 return boost::any( static_cast<bool>(boost::get(alps::boundary_crossing_t(),
105 graph.bond(bond_index_map[pos[0]][pos[1]]))) );
107 std::ostringstream ss;
108 ss <<
"No property '" <<
property <<
"' with " << pos.size() <<
" points implemented.";
109 throw std::runtime_error(ss.str());
120 alps::Parameters parms;
122 std::vector<std::vector<pos_t> > forward_;
123 std::vector<std::vector<pos_t> > backward_;
125 mutable std::map<pos_t, std::map<pos_t, pos_t> > bond_index_map;
definition of Lattice base class
graph_type::site_iterator site_iterator
std::vector< pos_t > all(pos_t p) const
std::vector< pos_t > forward(pos_t p) const
graph_type::site_descriptor site_descriptor
int maximum_vertex_type() const
alps::graph_helper graph_type
const graph_type & alps_graph() const
boost::any get_prop_(std::string const &property, std::vector< pos_t > const &pos) const
alps_lattice(const alps::Parameters &p)
lattice_impl::pos_t pos_t