mirror of
https://github.com/triqs/dft_tools
synced 2024-12-26 06:14:14 +01:00
Fixed computation of density for full matsub mesh
-> Previously, calculation was implicitly assuming a mesh with only positive matsubara frequencies. -> Added corresponding test -> Also added test of density calculation with or without correct tail.
This commit is contained in:
parent
6e87bee850
commit
82a6d21939
@ -42,8 +42,13 @@ int main() {
|
|||||||
TEST(Gt(.9));
|
TEST(Gt(.9));
|
||||||
TEST(Gt(-.1));//should be equal to line above
|
TEST(Gt(-.1));//should be equal to line above
|
||||||
|
|
||||||
|
//fourier
|
||||||
|
triqs::gfs::local::tail t(1,1);
|
||||||
|
gw_n (tau_) << 1/(tau_-1.);
|
||||||
|
auto gt_with_full_tail = make_gf_from_inverse_fourier(make_gf_from_g_and_tail(gw_n, gw.singularity()));
|
||||||
|
auto gt_tail_with_one_term = make_gf_from_inverse_fourier(make_gf_from_g_and_tail(gw_n, t));
|
||||||
|
TEST(gt_with_full_tail(.5));
|
||||||
|
TEST(gt_tail_with_one_term(.5));
|
||||||
}
|
}
|
||||||
TRIQS_CATCH_AND_ABORT;
|
TRIQS_CATCH_AND_ABORT;
|
||||||
}
|
}
|
||||||
|
@ -6,3 +6,15 @@
|
|||||||
|
|
||||||
(Gt(-.1)) ---> -0.40657
|
(Gt(-.1)) ---> -0.40657
|
||||||
|
|
||||||
|
(gt_with_full_tail(.5)) ---> ((0.5 *
|
||||||
|
[[-0.44347,0]
|
||||||
|
[0,-0.44347]]) + (0.5 *
|
||||||
|
[[-0.443038,0]
|
||||||
|
[0,-0.443038]]))
|
||||||
|
|
||||||
|
(gt_tail_with_one_term(.5)) ---> ((0.5 *
|
||||||
|
[[-0.44347,0]
|
||||||
|
[0,-0.44347]]) + (0.5 *
|
||||||
|
[[-0.443038,0]
|
||||||
|
[0,-0.443038]]))
|
||||||
|
|
||||||
|
33
test/triqs/gfs/gf_positive_and_negative_matsubara.cpp
Normal file
33
test/triqs/gfs/gf_positive_and_negative_matsubara.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
|
||||||
|
#include <triqs/gfs.hpp>
|
||||||
|
#include <triqs/gfs/local/functions.hpp>
|
||||||
|
using namespace triqs::gfs;
|
||||||
|
#define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> "<< (X) <<std::endl<<std::endl;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
try {
|
||||||
|
double beta =1;int n_im_freq=400;
|
||||||
|
auto G = gf<imfreq, scalar_valued> {{beta, Fermion, n_im_freq,false}};
|
||||||
|
auto G_pos_only = gf<imfreq, scalar_valued> {{beta, Fermion, n_im_freq,true}};
|
||||||
|
|
||||||
|
TEST(G.mesh().positive_only());
|
||||||
|
TEST(G_pos_only.mesh().positive_only());
|
||||||
|
//std::cout << G.singularity() << std::endl ;
|
||||||
|
triqs::clef::placeholder<0> om_;
|
||||||
|
G(om_) << 1/(om_ + 2.3);
|
||||||
|
G_pos_only(om_) << 1/(om_ + 2.3);
|
||||||
|
|
||||||
|
auto n = triqs::gfs::density(G);
|
||||||
|
auto n_pos_only = triqs::gfs::density(G_pos_only);
|
||||||
|
TEST(n);
|
||||||
|
TEST(n_pos_only);
|
||||||
|
|
||||||
|
// test hdf5
|
||||||
|
//H5::H5File file("gf_scalar.h5", H5F_ACC_TRUNC);
|
||||||
|
//h5_write(file, "g", G);
|
||||||
|
//h5_write(file, "gm", reinterpret_scalar_valued_gf_as_matrix_valued(G));
|
||||||
|
|
||||||
|
}
|
||||||
|
TRIQS_CATCH_AND_ABORT;
|
||||||
|
|
||||||
|
}
|
10
test/triqs/gfs/gf_positive_and_negative_matsubara.output
Normal file
10
test/triqs/gfs/gf_positive_and_negative_matsubara.output
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
(G.mesh().positive_only()) ---> 0
|
||||||
|
|
||||||
|
(G_pos_only.mesh().positive_only()) ---> 1
|
||||||
|
|
||||||
|
0
|
||||||
|
1
|
||||||
|
(n) ---> 0.908877
|
||||||
|
|
||||||
|
(n_pos_only) ---> 0.908877
|
||||||
|
|
@ -157,7 +157,8 @@
|
|||||||
[(0,0),(0.151719,-0.207234)]]
|
[(0,0),(0.151719,-0.207234)]]
|
||||||
|
|
||||||
----------------- 4 --------------------
|
----------------- 4 --------------------
|
||||||
(density(G3)) --->
|
(density(G3)) ---> 1
|
||||||
|
|
||||||
[[1.81775,0]
|
[[1.81775,0]
|
||||||
[0,1.81775]]
|
[0,1.81775]]
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace triqs { namespace gfs {
|
|||||||
|
|
||||||
for (size_t n1=0; n1<N1;n1++)
|
for (size_t n1=0; n1<N1;n1++)
|
||||||
for (size_t n2=0; n2<N2;n2++) {
|
for (size_t n2=0; n2<N2;n2++) {
|
||||||
dens_part(n1,n2) = dens_part(n1,n2) + real(dens_part(n2,n1)) - I * imag(dens_part(n2,n1)) + dens_tail(n1,n2);
|
dens_part(n1,n2) = dens_part(n1,n2) + (G.mesh().positive_only()? ( real(dens_part(n2,n1)) - I * imag(dens_part(n2,n1)) ) : 0) + dens_tail(n1,n2);
|
||||||
// ?? STRANGE ??
|
// ?? STRANGE ??
|
||||||
dens_part(n2,n1) = real(dens_part(n1,n2)) - I * imag(dens_part(n1,n2));
|
dens_part(n2,n1) = real(dens_part(n1,n2)) - I * imag(dens_part(n1,n2));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user