mirror of
https://github.com/triqs/dft_tools
synced 2024-12-25 13:53:40 +01:00
fourier. Add one overload to make_gf_from_fourier API.
- To be able to give explicitely the number of point. - two functions : if the number of points is not given, take as before. - updated the doc.
This commit is contained in:
parent
eeba763171
commit
8d7dd34aeb
@ -23,10 +23,18 @@ Synopsis
|
|||||||
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_view<imtime, Target, Opt> const&);
|
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_view<imtime, Target, Opt> const&);
|
||||||
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_const_view<imtime, Target, Opt> const&);
|
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_const_view<imtime, Target, Opt> const&);
|
||||||
|
|
||||||
|
gf<imfreq, Target, Opt> make_gf_from_fourier(gf<imtime, Target, Opt> const&, int n_iw);
|
||||||
|
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_view<imtime, Target, Opt> const&, int n_iw);
|
||||||
|
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_const_view<imtime, Target, Opt> const&, int n_iw);
|
||||||
|
|
||||||
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf<imfreq, Target, Opt> const&);
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf<imfreq, Target, Opt> const&);
|
||||||
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_view<imfreq, Target, Opt> const&);
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_view<imfreq, Target, Opt> const&);
|
||||||
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_const_view<imfreq, Target, Opt> const&);
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_const_view<imfreq, Target, Opt> const&);
|
||||||
|
|
||||||
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf<imfreq, Target, Opt> const&, int n_tau);
|
||||||
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_view<imfreq, Target, Opt> const&, int n_tau);
|
||||||
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_const_view<imfreq, Target, Opt> const&, int n_tau);
|
||||||
|
|
||||||
|
|
||||||
**fourier, inverse_fourier**
|
**fourier, inverse_fourier**
|
||||||
|
|
||||||
@ -57,10 +65,7 @@ We therefore use *a view* as LHS::
|
|||||||
**make_gf_from_fourier, make_gf_from_inverse_fourier**
|
**make_gf_from_fourier, make_gf_from_inverse_fourier**
|
||||||
|
|
||||||
In the case where we want to create a *new* container from the fourier transform of gt,
|
In the case where we want to create a *new* container from the fourier transform of gt,
|
||||||
we can use the function make_gf_from_fourier, in which choice is explicitly made to generate a new gf with the same number of points in the mesh.
|
we can use the function make_gf_from_fourier.
|
||||||
(Cf example below).
|
|
||||||
|
|
||||||
DOC TO BE FINISHED.
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
=========
|
=========
|
||||||
|
@ -3,17 +3,16 @@ using namespace triqs::gfs;
|
|||||||
int main() {
|
int main() {
|
||||||
double beta = 1, a = 1;
|
double beta = 1, a = 1;
|
||||||
int N = 10000;
|
int N = 10000;
|
||||||
auto gw = gf<imfreq>{{beta, Fermion, N}, {1, 1}};
|
auto gw = gf<imfreq>{{beta, Fermion, N/2}, {1, 1}};
|
||||||
auto gt = gf<imtime>{{beta, Fermion, N}, {1, 1}};
|
auto gt = gf<imtime>{{beta, Fermion, N}, {1, 1}};
|
||||||
|
|
||||||
triqs::clef::placeholder<0> om_;
|
triqs::clef::placeholder<0> om_;
|
||||||
gw(om_) << 1 / (om_ - a);
|
gw(om_) << 1 / (om_ - a);
|
||||||
|
|
||||||
// fills a full *view* of gt with the contents of the FFT
|
// fills a full *view* of gt with the contents of the FFT
|
||||||
// NB : the mesh of gt *must* have the same size as the mesh of gw.
|
|
||||||
gt() = inverse_fourier(gw);
|
gt() = inverse_fourier(gw);
|
||||||
|
|
||||||
// make a new fresh gf, with the same size mesh, from the FFT of gt
|
// make a new fresh gf from the FFT of gt with a mesh of size N/2
|
||||||
auto gw2 = make_gf_from_fourier(gt);
|
auto gw2 = make_gf_from_fourier(gt, N/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,17 +44,13 @@ Basic ``TailGf`` object
|
|||||||
|
|
||||||
from pytriqs.gf.local import *
|
from pytriqs.gf.local import *
|
||||||
|
|
||||||
t = TailGf(shape=(1,1))
|
t = TailGf(N1=1, N2=1)
|
||||||
print "t = ",t
|
print "t = ",t
|
||||||
print "t.data.shape = ",t.data.shape
|
print "t.data.shape = ",t.data.shape
|
||||||
print "t.order_min = ",t.order_min
|
print "t.order_min = ",t.order_min
|
||||||
print "t.order_max = ",t.order_max
|
print "t.order_max = ",t.order_max
|
||||||
print "t.mask = ",t.mask
|
print "t.mask = ",t.mask
|
||||||
print "t[1] = ",t[1]
|
print "t[1] = ",t[1]
|
||||||
t[1]=[1]
|
|
||||||
print "t = ",t
|
|
||||||
t[-1]=.25
|
|
||||||
print "t = ",t
|
|
||||||
print "t(100) = ",t(100)
|
print "t(100) = ",t(100)
|
||||||
|
|
||||||
|
|
||||||
@ -101,6 +97,7 @@ coefficients :math:`(\mathbf{a}_{-1})_{00} = 0`\ ,
|
|||||||
.. runblock:: python
|
.. runblock:: python
|
||||||
|
|
||||||
from pytriqs.gf.local import *
|
from pytriqs.gf.local import *
|
||||||
|
import numpy
|
||||||
g = GfImFreq(indices = [1], beta = 50, n_points = 1000, name = "imp")
|
g = GfImFreq(indices = [1], beta = 50, n_points = 1000, name = "imp")
|
||||||
g <<= inverse( iOmega_n + 0.5 )
|
g <<= inverse( iOmega_n + 0.5 )
|
||||||
g.tail.zero()
|
g.tail.zero()
|
||||||
|
@ -49,30 +49,32 @@ namespace gfs {
|
|||||||
void triqs_gf_view_assign_delegation(gf_view<imfreq, matrix_valued, no_tail> g,
|
void triqs_gf_view_assign_delegation(gf_view<imfreq, matrix_valued, no_tail> g,
|
||||||
gf_keeper<tags::fourier, imtime, matrix_valued, no_tail> const& L);
|
gf_keeper<tags::fourier, imtime, matrix_valued, no_tail> const& L);
|
||||||
|
|
||||||
template <typename Opt> gf_mesh<imfreq, Opt> make_mesh_fourier_compatible(gf_mesh<imtime, Opt> const& m) {
|
|
||||||
int L = (m.size() - (m.kind() == full_bins ? 1 : 0))/2;
|
|
||||||
return {m.domain(), L};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Opt>
|
|
||||||
gf_mesh<imtime, Opt> make_mesh_fourier_compatible(gf_mesh<imfreq, Opt> const& m, mesh_kind mk = full_bins) {
|
|
||||||
int L = 2*m.size() + (mk == full_bins ? 1 : 0);
|
|
||||||
return {m.domain(), L};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Target, typename Opt, bool V, bool C>
|
template <typename Target, typename Opt, bool V, bool C>
|
||||||
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_impl<imtime, Target, Opt, V, C> const& gt) {
|
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_impl<imtime, Target, Opt, V, C> const& gt, int n_iw) {
|
||||||
auto gw = gf<imfreq, Target, Opt>{make_mesh_fourier_compatible(gt.mesh()), get_target_shape(gt)};
|
auto m = gf_mesh<imfreq, Opt>{gt.mesh().domain(), n_iw};
|
||||||
|
auto gw = gf<imfreq, Target, Opt>{m, get_target_shape(gt)};
|
||||||
gw() = fourier(gt);
|
gw() = fourier(gt);
|
||||||
return gw;
|
return gw;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Target, typename Opt, bool V, bool C>
|
template <typename Target, typename Opt, bool V, bool C>
|
||||||
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_impl<imfreq, Target, Opt, V, C> const& gw, mesh_kind mk = full_bins) {
|
gf<imfreq, Target, Opt> make_gf_from_fourier(gf_impl<imtime, Target, Opt, V, C> const& gt) {
|
||||||
auto gt = gf<imtime, Target, Opt>{make_mesh_fourier_compatible(gw.mesh(), mk), get_target_shape(gw)};
|
return make_gf_from_fourier(gt, (gt.mesh().size() - (gt.mesh().kind() == full_bins ? 1 : 0)) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Target, typename Opt, bool V, bool C>
|
||||||
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_impl<imfreq, Target, Opt, V, C> const& gw, int n_tau,
|
||||||
|
mesh_kind mk = full_bins) {
|
||||||
|
auto m = gf_mesh<imtime, Opt>{gw.mesh().domain(), n_tau};
|
||||||
|
auto gt = gf<imtime, Target, Opt>{m, get_target_shape(gw)};
|
||||||
gt() = inverse_fourier(gw);
|
gt() = inverse_fourier(gw);
|
||||||
return gt;
|
return gt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Target, typename Opt, bool V, bool C>
|
||||||
|
gf<imtime, Target, Opt> make_gf_from_inverse_fourier(gf_impl<imfreq, Target, Opt, V, C> const& gw, mesh_kind mk = full_bins) {
|
||||||
|
return make_gf_from_inverse_fourier(gw, 2 * gw.mesh().size() + (mk == full_bins ? 1 : 0), mk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace clef {
|
namespace clef {
|
||||||
|
Loading…
Reference in New Issue
Block a user