ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
model_Ztwo.cpp File Reference
#include "dmrg/models/alps/symm_handler.hpp"
#include "dmrg/block_matrix/symmetry/z2.h"

Go to the source code of this file.

Functions

template<>
Ztwo::charge init_charge< Ztwo > (const alps::Parameters &parms, std::map< std::string, int > const &all_conserved_qn)
 
template<>
Ztwo::charge state_to_charge< Ztwo > (alps::site_state< short > const &state, alps::SiteBasisDescriptor< short > const &b, std::map< std::string, int > const &all_conserved_qn)
 

Function Documentation

template<>
Ztwo::charge init_charge< Ztwo > ( const alps::Parameters &  parms,
std::map< std::string, int > const &  all_conserved_qn 
)

Definition at line 34 of file model_Ztwo.cpp.

35 {
36  typedef std::map<std::string, int> qn_map_type;
37  assert(all_conserved_qn.size() == 1);
38  qn_map_type::const_iterator it = all_conserved_qn.begin();
39  int tmp = alps::evaluate<double>(static_cast<std::string>(parms[it->first+"_total"]), parms);
40  if (!(tmp == 0 || tmp == 1))
41  throw std::runtime_error("Invalid value for " + it->first + "_total");
42  return (tmp == 1) ? Ztwo::Minus : Ztwo::Plus;
43 }
Definition: z2.h:41
Definition: z2.h:41
template<>
Ztwo::charge state_to_charge< Ztwo > ( alps::site_state< short > const &  state,
alps::SiteBasisDescriptor< short > const &  b,
std::map< std::string, int > const &  all_conserved_qn 
)

Definition at line 46 of file model_Ztwo.cpp.

48 {
49  typedef std::map<std::string, int> qn_map_type;
50  int tmp = 0;
51  for (typename alps::SiteBasisDescriptor<short>::const_iterator it = b.begin(); it != b.end(); ++it) {
52  qn_map_type::const_iterator match = all_conserved_qn.find(it->name());
53  if (match != all_conserved_qn.end())
54  tmp = detail::to_integer( get_quantumnumber(state, it->name(), b) );
55  }
56  return (tmp % 4 == 0 ? Ztwo::Plus : Ztwo::Minus);
57 }
Definition: z2.h:41
int to_integer(alps::half_integer< T > const &qn_value)
Definition: z2.h:41