Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[do not merge] add test for measure static with complex Hloc #160

Draft
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(all_tests setup_Delta_tau_and_h_loc single_site_bethe atomic_observables kan
if(Local_hamiltonian_is_complex)
list(APPEND all_tests atomic_gf_complex atomdiag_ed complex_bug81)
if(Hybridisation_is_complex)
list(APPEND all_tests complex_Gtau_ED setup_Delta_tau_and_h_loc_complex)
list(APPEND all_tests complex_Gtau_ED setup_Delta_tau_and_h_loc_complex measure_static_complex)
endif()
endif()

Expand Down
48 changes: 48 additions & 0 deletions test/python/measure_static_complex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import numpy as np
from triqs.operators import *
from triqs_cthyb import *
from triqs.gf import *
from h5 import HDFArchive
from triqs.utility.h5diff import h5diff

""" This test was benchmarked against the an ED-solver that is
independent of TRIQS and was supplied by Wei Wu (May 2016).
Due to noise in the Monte Carlo data, it is not possible to
automatically check whether the CTHYB solver gives the same result
as the ED code.
Thus, this test just checks against the CTHYB data it produced when
the test was created, which were checked against the ED result.
The data from the ED solver can be found in the file
complex_Gtau_ED.bench.h5 for future reference.
"""

# the Hamiltonian of the system
# the first two orbitals are the impurity, the other two are the bath
H_mat = np.array([[-0.2 , 0.1j , 0.5 , 0.1 ],
[-0.1j ,-0.3 , 0.1 , 0.5 ],
[ 0.5 , 0.1 , 0.1 , 0.0 ],
[ 0.1 , 0.5 , 0.0 , 0.0 ]])
corr_dim = 2

G0_iw = GfImFreq(beta=10,indices=list(range(len(H_mat))),n_points=101)
G0_iw << inverse(iOmega_n - H_mat)

H_int = 3*n("ud",0)*n("ud",1)

p = {}
p["random_seed"] = 123
p["length_cycle"] = 100
p["n_warmup_cycles"] = 1000
p["n_cycles"] = 5000
p["use_norm_as_weight"] = True
p["measure_density_matrix"] = True

S = Solver(beta=10,gf_struct=[["ud",corr_dim]],n_tau=203,n_iw=101)
S.G0_iw << G0_iw[:corr_dim,:corr_dim]
S.solve(h_int=H_int,**p)

with HDFArchive("complex_Gtau_ED.out.h5","w") as ar:
ar["G_tau"]=S.G_tau

h5diff("complex_Gtau_ED.ref.h5","complex_Gtau_ED.out.h5")