3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-27 06:43:40 +01:00
dft_tools/doc/reference/c++/gf/tail_1.cpp
Olivier Parcollet 3fe400d34c doc : split c++ code from rst
- examples split from the rst file using a python script (split_code).
- Final result for the doc is unchanged.
- examples are compiled and tested with the other tests.
- examples' code have been clang-formatted, with triqs style.
- doc compiles much faster, and with the same options as the rest of the
  test.
- examples are added as tests, so they are run by make test, as simple C
  tests.
- done for the tutorials and the reference.
- autocompile removed (changed into triqs_example directive).
- add triqs_example :
   - make a literal include of the source code.
   - runs the compiled example
   - add, as before, the result to the source code in the doc.
- added the script split_code, used to make the changes automatically,
  maybe for later reuse. (in _tools)
2014-05-31 23:00:16 +02:00

24 lines
974 B
C++

#include <triqs/gfs.hpp>
#include <triqs/gfs/local/fit_tail.hpp>
using namespace triqs::gfs;
int main() {
triqs::clef::placeholder<0> iom_;
double beta = 10;
int N = 100;
auto gw = gf<imfreq>{{beta, Fermion, N}, {1, 1}};
gw(iom_) << 1 / (iom_ - 1);
size_t n_min = 50; // linear index on mesh to start the fit
size_t n_max = 90; // final linear index for fit (included)
int n_moments = 4; // number of moments in the final tail (including known ones)
int size = 1; // means that we know one moment
int order_min = 1; // means that the first moment in the final tail will be the first moment
auto known_moments = local::tail(make_shape(1, 1), size, order_min); // length is 0, first moment to fit is order_min
known_moments(1) = 1.; // set the first moment
set_tail_from_fit(gw, known_moments, n_moments, n_min, n_max,
true); // true replace the gf data in the fitting range by the tail values
std::cout << gw.singularity() << std::endl;
}