mirror of
https://github.com/triqs/dft_tools
synced 2024-12-26 14:23:38 +01:00
4af1afbdaf
- For users : only change is : H5::H5File in apps. to be replaced by triqs::h5::file, same API. - using only the C API because : - it is cleaner, better documented, more examples. - it is the native hdf5 interface. - simplify the installation e.g. on mac. Indeed, hdf5 is usually installed without C++ interface, which is optional. E.g. EPD et al., brew by default. Also the infamous mpi+ hdf5_cpp bug, for which we have no clean solution. - clean the notion of parent of a group. Not needed, better iterate function in C LT API. - modified doc : no need for C++ bindings any more. - modified cmake to avoid requiring CPP bindings.
34 lines
992 B
C++
34 lines
992 B
C++
//#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::file 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;
|
|
|
|
}
|