ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sim.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-2013 by Bela Bauer <bauerb@phys.ethz.ch>
7  * Michele Dolfi <dolfim@phys.ethz.ch>
8  *
9  * This software is part of the ALPS Applications, published under the ALPS
10  * Application License; you can use, redistribute it and/or modify it under
11  * the terms of the license, either version 1 or (at your option) any later
12  * version.
13  *
14  * You should have received a copy of the ALPS Application License along with
15  * the ALPS Applications; see the file LICENSE.txt. If not, the license is also
16  * available from http://alps.comp-phys.org/.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
21  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
22  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  *
26  *****************************************************************************/
27 
28 #ifndef APP_SIM_H
29 #define APP_SIM_H
30 
31 #include "dmrg/version.h"
32 
33 #include <cmath>
34 #include <iterator>
35 #include <iostream>
36 
37 #include <boost/filesystem.hpp>
38 #include <boost/optional.hpp>
39 
41 
43 #include "dmrg/mp_tensors/mps.h"
44 #include "dmrg/mp_tensors/mpo.h"
51 
52 #include "dmrg/utils/random.hpp"
54 #include "utils/timings.h"
55 
56 #include "dmrg/models/lattice.h"
57 #include "dmrg/models/model.h"
59 
60 
61 class abstract_sim {
62 public:
63  virtual ~abstract_sim() {}
64  virtual void run() =0;
65 };
66 
67 
68 template <class Matrix, class SymmGroup>
69 class sim : public abstract_sim {
70 public:
71  sim(DmrgParameters const &);
72  virtual ~sim();
73 
74  virtual void run() =0;
75 
76 protected:
78  typedef std::map<std::string, int> status_type;
79 
80  virtual std::string results_archive_path(status_type const&) const;
81 
83  virtual void measure(std::string archive_path, measurements_type & meas);
84  // TODO: can be made const, now only problem are parameters
85 
86  virtual void checkpoint_simulation(MPS<Matrix, SymmGroup> const& state, status_type const&);
87 
88 protected:
90 
92  bool restore;
93  bool dns;
94  std::string chkpfile;
95  std::string rfile;
96 
98 
104 };
105 
106 #include "sim.hpp"
107 #endif
Model< Matrix, SymmGroup >::measurements_type measurements_type
Definition: sim.h:77
virtual void measure(std::string archive_path, measurements_type &meas)
Definition: sim.hpp:161
definition of Lattice base class
DmrgParameters parms
Definition: sim.h:89
pimpl for Model
Definition: model.h:96
virtual void run()=0
declaration of the MPS class (vector of MPSTensor)
std::string chkpfile
Definition: sim.h:94
definition of Model base class
MPS< Matrix, SymmGroup > mps
Definition: sim.h:101
measurements_type iteration_measurements(int sweep)
Definition: sim.hpp:112
Definition: sim.h:69
measurements_type sweep_measurements
Definition: sim.h:103
Model< Matrix, SymmGroup > model
Definition: sim.h:100
time_stopper stop_callback
Definition: sim.h:97
Definition: mpo.h:36
std::map< std::string, int > status_type
Definition: sim.h:78
virtual ~sim()
Definition: sim.hpp:126
virtual void checkpoint_simulation(MPS< Matrix, SymmGroup > const &state, status_type const &)
Definition: sim.hpp:131
utility functions for the MPO
include one of the Index class definitions
bool restore
Definition: sim.h:92
virtual std::string results_archive_path(status_type const &) const
Definition: sim.hpp:147
definition of MPO class (vector of MPOTensor)
declaration of the TwoSiteTensor class
Definition: mps.h:40
bool dns
Definition: sim.h:93
std::string rfile
Definition: sim.h:95
definition of simulation class
virtual ~abstract_sim()
Definition: sim.h:63
int init_sweep
Definition: sim.h:91
functions to operate on MPS and MPO (compute expectation values, etc.)
Adapted from alps/ngs/scheduler/stop_callback.hpp.
Definition: time_stopper.h:34
impl_type::measurements_type measurements_type
Definition: model.h:109
int init_site
Definition: sim.h:91
Lattice lat
Definition: sim.h:99
measurements_type all_measurements
Definition: sim.h:103
functions to initialize the MPS
sim(DmrgParameters const &)
Definition: sim.hpp:31
MPO< Matrix, SymmGroup > mpo
Definition: sim.h:102
pimpl resolved Lattice
Definition: lattice.h:84
functions to contract tensor network states
virtual void run()=0
include all Measurements
MPO< Matrix, SymmGroup > mpoc
Definition: sim.h:102