ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
model_factory_symm.h
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 
27 #include "matrices.h"
28 
31 
33 
34 
35 // init MACROS
36 #define impl_model_factory(MATRIX, SYMMGROUP) \
37 template boost::shared_ptr<model_impl<MATRIX, SYMMGROUP> > \
38 model_factory<MATRIX,SYMMGROUP>(Lattice const&, BaseParameters &);
39 
40 // Implementation
41 template <class Matrix, class SymmGroup>
42 boost::shared_ptr<model_impl<Matrix, SymmGroup> >
43 model_factory(Lattice const& lattice, BaseParameters & parms)
44 {
45  typedef boost::shared_ptr<model_impl<Matrix, SymmGroup> > impl_ptr;
46  if (parms["model_library"] == "alps") {
47  if (parms["lattice_library"] != "alps")
48  throw std::runtime_error("ALPS models require ALPS lattice.");
49  return impl_ptr( new ALPSModel<Matrix, SymmGroup>(lattice, parms) );
50  } else if (parms["model_library"] == "coded") {
51  return coded_model_factory<Matrix, SymmGroup>::parse(lattice, parms);
52  } else {
53  throw std::runtime_error("Don't know this model_library!");
54  }
55 
56 }
57 
boost::shared_ptr< model_impl< Matrix, SymmGroup > > model_factory(Lattice const &lattice, BaseParameters &parms)
model factory
pimpl resolved Lattice
Definition: lattice.h:84
static boost::shared_ptr< model_impl< Matrix, SymmGroup > > parse(Lattice const &, BaseParameters &)