GithubHelp home page GithubHelp logo

triqs / maxent Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 12.0 2.02 MB

Maximum Entropy Codes

Home Page: https://triqs.github.io/maxent

License: GNU General Public License v3.0

CMake 3.54% Python 95.99% Shell 0.30% Dockerfile 0.17%

maxent's Introduction

maxent's People

Contributors

dylex avatar gkraberger avatar mzingl avatar the-hampel avatar wentzell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maxent's Issues

Failed Test set_G_tau_complex_matrix

Hi!
I found that the test set_G_tau_complex_matrix fails. After inspecting the testing output it seems like a minor issue of rounding errors but I thought I let you know. Here is the output of the test:

AssertionError:
Arrays are not almost equal to 13 decimals

Mismatched elements: 5512 / 6007 (91.8%)
Max absolute difference: 1.35742084e-10
Max relative difference: 8.19991319e-10
 x: array([-0.3111849165918, -0.4986941030354, -0.5142547362803, ...,
       -0.5423565362871, -0.5084568296734, -0.2299699869492])
 y: array([-0.3111849165917, -0.4986941030063, -0.5142547362512, ...,
       -0.542356536258 , -0.5084568297025, -0.2299699869492])

I am using maxent commit 734bc56 and triqs commit 5514b6ff7d9ff18eff9ae21572fc43c2e74f5bd6
I am installing on Ubuntu 18.04 with python from anaconda.
This is the output of cmake: https://gist.github.com/malte-schueler/263acf2dd43bb8e17c05fcdbd7d2243b

s_w from s_iw

Dear all
Hi
I want plot the density of states of "Sr2RuO4" using DFT+DMFT method by triqs (with version 3.0.0) and WIEN2k codes . After a full charge self consistency , for calculation of real part of Sigma I used maxent method. for this purpose I used below scripts:

`from triqs_maxent import *
from h5 import *

Load self-energy from h5-file

with HDFArchive('Sr2RuO4_b37.h5', 'r') as ar:
S_iw = ar['S_iw']
dc = ar['dc']

Initialize SigmaContinuator, we use the

double counting (dc) as constant shift c.

isc = InversionSigmaContinuator(S_iw, dc)

run TauMaxEnt for each block and collect results

in dict res.

res = {}
for name, gaux_iw in isc.Gaux_iw:
tm = TauMaxEnt()
tm.set_G_iw(gaux_iw)
tm.set_error(1e-4)
tm.omega = HyperbolicOmegaMesh(omega_min=-10, omega_max=10, n_points=500)
tm.alpha_mesh = LogAlphaMesh(alpha_min=1e-2, alpha_max=1e2, n_points=30)
res[name] = tm.run()

save results and the SigmaContinuator to h5-file

with HDFArchive('Sr2RuO4_b37.h5', 'a') as ar:
for key in res:
ar['maxent_result_' + key] = res[key].data
ar['isc'] = isc`

and:

`from triqs_maxent import *
from h5 import *
from triqs.plot.mpl_interface import oplot

load res and SigmaContinuator from h5-file

res = {}
with HDFArchive('Sr2RuO4_b37.h5', 'r') as ar:
S_iw = ar['S_iw']
for key in S_iw.indices:
res[key] = ar['maxent_result_' + key]
isc = ar['isc']

get S_w from the auxilliary spectral function Aaux_w

Aaux_w = {}
w = res['up_0'].omega
for key in res:
Aaux_w[key] = res[key].analyzer_results['LineFitAnalyzer']['A_out']
isc.set_Gaux_w_from_Aaux_w(Aaux_w, w, np_interp_A=10000,
np_omega=4000, w_min=-1.0, w_max=1.0)

save SigmaContinuator again (now it contains S_w)

with HDFArchive('Sr2RuO4_b37.h5', 'a') as ar:
ar['isc'] = isc

check linfit and plot S_w

plt.figure()
plt.subplot(1, 2, 1)
for key in res:
res[key].analyzer_results['LineFitAnalyzer'].plot_linefit()
plt.ylim(1e1, 1e4)
plt.subplot(1, 2, 2)
oplot(isc.S_w['up_0'], mode='I', label='maxent xy', lw=3)
oplot(isc.S_w['up_1'], mode='I', label='maxent xz', lw=3)
plt.ylabel(r'$\Sigma(\omega)$')
plt.xlim(-0.75, 0.75)
plt.ylim(-0.4, 0.0)`

I could run this scripts without any error but when I want use S_W for post processing by the following script:

from triqs_dft_tools.sumk_dft import * with HDFArchive('Sr2RuO4_b37.h5', 'r') as ar: SigmaReFreq = ar['dmft_output']['Sigma_w'] SK.set_Sigma([SigmaReFreq]) chemical_potential, dc_imp, dc_energ = SK.load(['chemical_potential','dc_imp','dc_energ']) SK.set_mu(chemical_potential) SK.set_dc(dc_imp,dc_energ)

I have an error that:

tarting run with 1 MPI rank(s) at : 2020-12-23 01:07:00.014444 Traceback (most recent call last): File "7.py", line 3, in <module> SigmaReFreq = ar['dmft_output']['Sigma_w'] File "/home/reyhan/triqs/triqs/triqs.install/lib/python3.6/site-packages/h5/archive.py", line 205, in __getitem__ return self.__getitem1__(key,self._reconstruct_python_objects) File "/home/reyhan/triqs/triqs/triqs.install/lib/python3.6/site-packages/h5/archive.py", line 211, in __getitem1__ raise KeyError("Key %s does not exist."%key) KeyError: 'Key dmft_output does not exist.'
I check my "case.h5" and see that it has below content:
"['S_iw', 'dc', 'isc', 'maxent_result_down_0', 'maxent_result_down_1', 'maxent_result_down_2', 'maxent_result_up_0', 'maxent_result_up_1', 'maxent_result_up_2']>"

Have you any idea about my problem?
Sincerely yours
Reyhaneh

Install documentation & python3

Is it correct that the current (unstable) branch is not compatible with python2-based TRIQS installations and that the tag py2_compat should be used in that case? Is it possible to mention this in the installation documentation?

Sigma_w from Sigma_iw

Dear All
Hi
After a DFT+DMFT calculation, I want to conversion Sigma_iw to Sigma_w using max-entropy.
For doing it, I run "sigma_continuator_SRO_1 and 2" from maxant site for SrVO3 compound.
But when I run "sigma_continuator_SRO_2.py" for this compound but I have the below error:
"AttributeError:'InversionSigmaContinuator object has no attribute 'Sigma_w'
Can you please help me how I can conversion "Sigma_iw" from "case.h5" file to "Sigma_w" and save it in to this file?
Thank you ery much for any help to me
Reyhaneh

S_w

Dear All
Hi
I have a question. After using "maxent"In my "case.h5" and in it's group isc I have S_w. How can I use S_w in my cas.py.
I wrote the below program but I have the error that:NameError: name 'S_w' is not defined

"with HDFArchive('case.h5', 'r') as ar:
S_w = ar['isc']['S_w']"
Can you please help me to solve this problem.
Thanks a lot.
Reyhaneh

Error during analytic continuation for real-frequency self-energy

Dear all,
I want to calculate the real frequency self energy for calculating the DOS and the band structure of SrVO3. I have installed MAXENT successfully. I use the following commands to get the real frequency.

from pytriqs.archive import HDFArchive

load G_tau from h5

h5 = HDFArchive('SrVO3.h5','r')

this will show you the content

print h5['DMFT_results']

G_tau = h5['DMFT_results']['it_15']['Gimp_tau_0']

tm_bryan = TauMaxEnt(cost_function='bryan', probability='normal')

this will set the just loaded Gtau, this is just the spin up block and the first orbital!

tm_bryan.set_G_tau(G_tau['up_0'][0,0].real)

tm_bryan.omega = HyperbolicOmegaMesh(omega_min=-15, omega_max=15, n_points=400)

this is also just a suggestion, play around with the alpha values

tm_bryan.alpha_mesh = LogAlphaMesh(alpha_min=5e-5, alpha_max=500, n_points=20)

careful about setting the error!

tm_bryan.set_error(1.e-2)

run it

tm_bryan_res = tm_bryan.run()

But I am getting the following error.
Traceback (most recent call last):
File "new2.py", line 5, in
print h5['DMFT_results']
File "/home/jatin/triqs/install/lib/python2.7/site-packages/pytriqs/archive/hdf_archive.py", line 228, in getitem
return self.getitem1(key,self._reconstruct_python_objects)
File "/home/jatin/triqs/install/lib/python2.7/site-packages/pytriqs/archive/hdf_archive.py", line 235, in getitem1
if key not in self : raise KeyError, "Key %s does not exist."%key
KeyError: 'Key DMFT_results does not exist.'

Any suggestion is appreciated.

Best Regards,
CMTCL

~

Error during analytical continuation

Dear All,
Initially I installed TRIQS, DFTTools, CTHYB, MAXENT using ubuntu debian packages. Due to getting some environmental problem I again installed TRIQS, DFTTools, CTHYB using conda, but MAXENT is installed using ubuntu debian packages. I am running a test calculation for LaMnO3.
I am getting the following error. I have used the following python script.
maxent.zip

Traceback (most recent call last):
File "maxent.py", line 3, in
from triqs_maxent import *
ImportError: No module named triqs_maxent

The same error is also appearing for analytical continuation of SrVO3, which was run with out any error, when I installed TRIQS, DFTTools, CTHYB, MAXENT using debian packages.

Honestly I want to know whether it is related to anaconda. I already tried to debug the error as python error. If it is really related to python error, please let me know, I will close the issue and debug the error myself.

Warm Regards
CMTCL

Analytic Continuation of G_iw

Dear all:

I used the following script to get the Matsubara frequency Green's function. How to use MaxEnt to get it in the real frequency?

from triqs.gf import *
from triqs.operators import *
from h5 import *
import triqs.utility.mpi as mpi
from triqs_cthyb import Solver

# Set up a few parameters
U = 2.5
half_bandwidth = 1.0
chemical_potential = U/2.0
beta = 100
n_loops = 5

# Construct the CTQMC solver
S = Solver(beta = beta, gf_struct = [ ('up',1), ('down',1) ])

# Initalize the Green's function to a semi circular DOS
S.G_iw << SemiCircular(half_bandwidth)

# Now do the DMFT loop
for i_loop in range(n_loops):

    # Compute new S.G0_iw with the self-consistency condition while imposing paramagnetism
    g = 0.5 * (S.G_iw['up'] + S.G_iw['down'])
    for name, g0 in S.G0_iw:
        g0 << inverse(iOmega_n + chemical_potential - (half_bandwidth/2.0)**2 * g)

    # Run the solver
    S.solve(h_int = U * n('up',0) * n('down',0),    # Local Hamiltonian
            n_cycles = 5000,                        # Number of QMC cycles
            length_cycle = 200,                     # Length of a cycle
            n_warmup_cycles = 1000)                 # How many warmup cycles
    
oplot(S.`G_iw`)

I went through few example in the Documentation, but I failed to do it for this simple case.

Continuation of self-energies

Dear All
Hi
I run the Continuation of self-energies for SrVO3 compound using maxentropy method. I used the script for my work that is the same of Sr2RuO4 script which are implemented in maxantropy method in triqs code. but in my script I set dc-energy to -0.004687675298281441 that obtained from my LDA+DMFT calculation considering spinpolarise interaction and also I changed the window energy to -7 to 7 eV.
But After this executation I have the below result for Sigma for example for block-names up_1:
[[[ 0.98501606-0.30395847j]]

[[ 1.11531127-0.40518312j]]

[[ 1.20902543-0.44647038j]]
...
...

[[ 0.70354585-0.38301626j]]

[[ 0.68045362-0.40761561j]]

[[ 0.65748259-0.43339452j]]

[[ 0.63468014-0.46039073j]]

[[ 0.61209789-0.48864141j]]

[[ 0.58979190-0.51818283j]]

[[ 0.56782290-0.54905004j]]]

could you please help me to knowing that how I can obtain the true results for my calculation?
thank you very much
Reyhaneh

Sigma_w

Dear all
Hi
I run the "sigma_continuator_SRO_1and2.py" that are implemented in maxentropy program.
"

load res and SigmaContinuator from h5-file

res = {}
with HDFArchive('srvo3.h5', 'r') as ar:
S_iw = ar['dmft_output']['Sigma_iw']
for key in S_iw.indices:
res[key] = ar['maxent_result_' + key]
ar['isc'] = isc

get S_w from the auxilliary spectral function Aaux_w

Aaux_w = {}
w = res['up_0'].omega
for key in res:
Aaux_w[key] = res[key].analyzer_results['LineFitAnalyzer']['A_out']

isc.set_Gaux_w_from_Aaux_w(Aaux_w, w, np_interp_A=10000,
np_omega=4000, w_min=-1.0, w_max=1.0)

save SigmaContinuator again (now it contains S_w)

with HDFArchive('srvo3.h5', 'a') as ar:
ar['isc'] = isc

check linfit and plot S_w

fig1 = plt.figure()
plt.subplot(1, 2, 1)
for key in res:
res[key].analyzer_results['LineFitAnalyzer'].plot_linefit()
plt.ylim(1e1, 1e4)
plt.subplot(1, 2, 2)
oplot(isc.S_w['up_0'], mode='I', label='maxent xy', lw=3)
oplot(isc.S_w['up_1'], mode='I', label='maxent xz', lw=3)
plt.ylabel(r'$\Sigma(\omega)$')
plt.xlim(-0.75, 0.75)
plt.ylim(-0.4, 0.0)
fig1.savefig('sigma_continuator_srvo3.png')
"
But when I run these scripts for srvo3 compound instead of Sr2RuO4 compound, I have very bad results :(((

can you please help me to solving my problem?
thanks so much
Sincerely yours
Reyhaneh

error with triqs3

Dear all
Hi
I installed triqs code with version 3 on my computer. when I want install the maxent program from the "https://triqs.github.io/maxent/latest/install.html" website, after the "make" command I have not any thing in the command line . then, when I used the "make test" command all test were failed with the error "make: *** [Makefile:95: test] Error 8" . can you help me about this problem?
Thank you very much
Reyhaneh

real-frequency of self-energy

Dear all
Hi
I want to calculate post processing information by using DFT+DMFT.
I know that I shoud have the rael frequency self energy by using maxent.
I read about it. But can you help me to done it?
means can any one tell me the steps for doing it?
thanks for any help to me

Analytical continuation of matrix-valued self-energy

Dear All,

Following the methodology provided in the documentation of the MaxEnt code regarding the analytical-continuation of a matrix-valued self-energy using the InversionSigmaContinuator, I get extreme values in the off-diagonal elements. Are there any additional steps (to the documentation) required to properly continue such matrix-valued self-energies?? Or it is just a known problem that needs to be addressed individually given the case?

Best,
Danny

Error in tm_bryan.set_omega

Dear @manuel,
I am trying to supply the G_tau for analytic continuation, but I am getting the following error.

from pytriqs.archive import HDFArchive
from triqs_maxent import *
from triqs_maxent.tau_maxent import TauMaxEnt

load G_tau from h5 file

h5 = HDFArchive('SrVO3.h5', 'r')

show the content of h5 file

print h5

loard the desired Gtau

G_tau = h5['D=1']
tm_bryan = TauMaxEnt(cost_function='bryan', probability='normal')

this will set the loaded G_tau

tm_bryan.set_G_tau(G_tau((1000, 1, 2).real)
tm_bryan.set_omega = HyperbolicOmegaMesh(omega_min=-15, omega_max=15, n_points=400)
tm_bryan.alpha_mesh = LogAlphaMesh(alpha_min=5e-5, alpha_max=500, n_points=20)

set the error carefully

tm_bryan.set_error(10*err)

result = tm_bryan.run()

The error here is

File "MAC1.py", line 13
tm_bryan.set_omega = HyperbolicOmegaMesh(omega_min=-15, omega_max=15, n_points=400)
^
SyntaxError: invalid syntax

I will be helpful for your suggestion.

Best Regards
CMTCL

IndexError: index 5 is out of bounds for axis 1 with size 5

I did some DMFT calculations using dft_tools but I'm a bit stuck on the maxent analysis.

indeed i made the calculation for two correlated atoms which i want to plot each of the orbitals d(dxy,dxy,dz2,dxz,dx2-y2) for atom1 and 2. i used the model of the maxent script present here MAXENT.

i attach here the example of my maxent file. and the error message please do you have an idea for these two atoms? and when the calculation is spin polarized?

ERROR:

Traceback (most recent call last):
  File "max.py", line 40, in <module>
    gf = gf + G_latt['up'][iO,iO]
  File /TRIQS/install/lib/python3.8/site-packages/triqs/gf/gf.py", line 359, in __getitem__
    dat = self._data[ self._rank*(slice(0,None),) + key_tpl ]
IndexError: index 5 is out of bounds for axis 1 with size 5

``

[script.zip](https://github.com/TRIQS/maxent/files/7720110/script.zip)



ERROR IN CONVERTING Gaux_w from Aaux_w

Dear TRIQS/MAXENT Team,
I want to obtain real-frequency self energy. I successfully run MAXENT. In order to get real-frequency self energy, I used InversionSigmaContinuator(isc), using the relevant command

with HDFArchive('SrVO3.h5', 'r') as ar:
Sigma_iw = ar['dmft_output']['Sigma_iw']
for key in Sigma_iw.indices:
res[key] = ar['dmft_output/Sigma_iw/' + key]

get S_w from the auxilliary spectral function Aaux_w

Aaux_w = {}
w = res['up_0'].data

for key in Sigma_iw.indices:
#print(key)
#print(res[key])
res[key].analyzer_results['LineFitAnalyzer']['A_out'] = Aaux_w[key]

isc.set_Gaux_w_from_Aaux_w(Aaux_w, w, np_interp_A=10000,
np_omega=4000, w_min=-1.0, w_max=1.0)

save SigmaContinuator again (now it contains S_w)

with HDFArchive('SrVO3_maxent.h5' , 'a') as ar:
ar['isc'] = isc

By using it, I am getting the following error.
Traceback (most recent call last):
File "maxent.py", line 74, in
res[key].analyzer_results['LineFitAnalyzer']['A_out'] = Aaux_w[key]
KeyError: 'up_2'

I have been trying a lot to sort-out the error.
can any one suggest what is the error here?

Best Regards
CMTCL

verbosity during run

Hello,

Im currently trying to run this code without getting text output into my terminal. I found on the website that there exist this function set_verbosity(), but for me it is doing nothing.

    tm = TauMaxEnt(cost_function='bryan', probability='normal')
    tm.set_verbosity(0)
    tm.set_G_tau(gtau)
    tm.set_error(0.001)
    result = tm.run()

With kind regards
Marcel Klett

Crash for matrix-valued self energy

I have an issue with the matrix-valued self energy, which might be the same problem as in issue #11.
In the file maxent_util.py in line 103, the code crashes because it tries to assign a numpy array of length np_interp_A (RHS) to a numpy array of length n_w (LHS).

The error produced is ValueError: could not broadcast input array from shape (2000) into shape (100)

Many tests fail on Intel Skylake CPUs

This is more of a heads up because there is nothing you can really do about that, because this is an issue with OpenBLAS.

On Intel Skylake CPUs the numpy.linalg.svd routine is broken and gives wrong output. See also numpy/numpy#13401

As a workaround users can set the architecture for OpenBLAS to something that doesn't exhibit the problem. For the CPU that showed the failing tests using haswell worked.

$ export OPENBLAS_VERBOSE=2
$ python3 maxent_result.py
Core: SkylakeX
Warning: could not identify MPI environment!
Starting serial run at: 2022-04-06 14:15:29.548704
Traceback (most recent call last):
  File "maxent_result.py", line 129, in <module>
    "{} not equal".format(key)
AssertionError: A not equal
$ export OPENBLAS_CORETYPE=haswell
$ python3 maxent_result.py
Core: Haswell
Warning: could not identify MPI environment!
Starting serial run at: 2022-04-06 14:15:57.296254

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.