ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
overlap.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 Bela Bauer <bauerb@phys.ethz.ch>
7  * 2011-2013 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 MEASUREMENTS_OVERLAP_H
29 #define MEASUREMENTS_OVERLAP_H
30 
33 
34 namespace measurements {
35 
36  template <class Matrix, class SymmGroup>
37  class overlap : public measurement<Matrix, SymmGroup> {
39  public:
40  overlap(std::string const& name_,
41  std::string const& ckp_)
42  : base(name_)
43  , bra_ckp(ckp_)
44  { this->cast_to_real = false; }
45 
46  void evaluate(MPS<Matrix, SymmGroup> const& mps, boost::optional<reduced_mps<Matrix, SymmGroup> const&> rmps = boost::none)
47  {
48  maquis::cout << " overlap with " << bra_ckp << "." << std::endl;
49  MPS<Matrix, SymmGroup> bra_mps;
50  load(bra_ckp, bra_mps);
51 
52  if (bra_mps[bra_mps.length()-1].col_dim().sum_of_sizes() == 1)
53  this->result = ::overlap(bra_mps, mps);
54  else
55  this->vector_results = multi_overlap(bra_mps, mps);
56  }
57 
58  protected:
60  {
61  return new overlap(*this);
62  }
63 
64  private:
65  std::string bra_ckp;
66  };
67 
68 }
69 
70 #endif
void load(alps::hdf5::archive &ar, std::string const &path, TrivialGroup::charge &value, std::vector< std::size_t > chunk=std::vector< std::size_t >(), std::vector< std::size_t > offset=std::vector< std::size_t >())
Definition: none.h:81
value_type result
Definition: measurement.h:79
measurement< Matrix, SymmGroup > * do_clone() const
Definition: overlap.h:59
std::vector< typename MPS< Matrix, SymmGroup >::scalar_type > multi_overlap(MPS< Matrix, SymmGroup > const &mps1, MPS< Matrix, SymmGroup > const &mps2)
Definition: mps_mpo_ops.h:154
overlap(std::string const &name_, std::string const &ckp_)
Definition: overlap.h:40
void evaluate(MPS< Matrix, SymmGroup > const &mps, boost::optional< reduced_mps< Matrix, SymmGroup > const & > rmps=boost::none)
Definition: overlap.h:46
std::vector< typename MPS< Matrix, SymmGroup >::scalar_type > vector_results
Definition: measurement.h:80
Index< SymmGroup > const & col_dim(size_t i) const
Definition: mps.h:61
definition of Measurement base class
Definition: mps.h:40
functions to operate on MPS and MPO (compute expectation values, etc.)
size_t length() const
Definition: mps.h:58
bool cast_to_real
Definition: measurement.h:77