ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
model_2u1.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * ALPS MPS DMRG Project
4  *
5  * Copyright (C) 2013 Institute for Theoretical Physics, ETH Zurich
6  * 2011-2011 by Michele Dolfi <dolfim@phys.ethz.ch>
7  *
8  * This software is part of the ALPS Applications, published under the ALPS
9  * Application License; you can use, redistribute it and/or modify it under
10  * the terms of the license, either version 1 or (at your option) any later
11  * version.
12  *
13  * You should have received a copy of the ALPS Application License along with
14  * the ALPS Applications; see the file LICENSE.txt. If not, the license is also
15  * available from http://alps.comp-phys.org/.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  *
25  *****************************************************************************/
26 
29 
30 // Symmetry dependent implementation
31 
32 // TwoU1 Symmetry
33 template <>
34 TwoU1::charge state_to_charge<TwoU1>(alps::site_state<short> const & state, alps::SiteBasisDescriptor<short> const& b,
35  std::map<std::string, int> const& all_conserved_qn)
36 {
37  typedef std::map<std::string, int> qn_map_type;
39  for (alps::SiteBasisDescriptor<short>::const_iterator it = b.begin(); it != b.end(); ++it) {
40  qn_map_type::const_iterator match = all_conserved_qn.find(it->name());
41  if (match != all_conserved_qn.end())
42  c[match->second] = detail::to_integer( get_quantumnumber(state, it->name(), b) );
43  }
44  return c;
45 }
46 
47 template <>
48 TwoU1::charge init_charge<TwoU1> (const alps::Parameters& parms, std::map<std::string, int> const& all_conserved_qn)
49 {
50  typedef std::map<std::string, int> qn_map_type;
51  assert(all_conserved_qn.size() == 2);
52 
54  for (qn_map_type::const_iterator it=all_conserved_qn.begin(); it!=all_conserved_qn.end(); ++it) {
55  alps::half_integer<short> tmp = alps::evaluate<double>(static_cast<std::string>(parms[it->first+"_total"]), parms);
56  c[it->second] = detail::to_integer(tmp);
57  }
58 
59  return c;
60 }
int to_integer(alps::half_integer< T > const &qn_value)
TwoU1::charge init_charge< TwoU1 >(const alps::Parameters &parms, std::map< std::string, int > const &all_conserved_qn)
Definition: model_2u1.cpp:48
TwoU1::charge state_to_charge< TwoU1 >(alps::site_state< short > const &state, alps::SiteBasisDescriptor< short > const &b, std::map< std::string, int > const &all_conserved_qn)
Definition: model_2u1.cpp:34
static const charge IdentityCharge
Definition: nu1_tpl.h:273