Change integration in DOS.density() to make careful integration over nonlinear meshes - #67
Open
aeantipov wants to merge 2 commits into
Open
Change integration in DOS.density() to make careful integration over nonlinear meshes#67aeantipov wants to merge 2 commits into
aeantipov wants to merge 2 commits into
Conversation
Author
|
To check the results I used the following script ( A[0].eps is a logarithmic grid with several dense points ): f=lambda x : exp(-x*x)/sqrt(pi)
G=DOS_from_function(lambda x : exp(-x*x)/sqrt(pi), xmin = -6, xmax = 6, Npts = len(A[0].eps))
val=[]
for eps in A[0].eps:
val.append(f(eps))
G2 = DOS(eps = A[0].eps, rho = val)
print "Regular mesh : ", G.density(10)
print "Logarithmic mesh : ", G2.density(10)
Before was: Regular mesh : 1.0 Logarithmic mesh : 68.0356596281 And with a patch I get Regular mesh : 1.0 Logarithmic mesh : 1.00002354885 |
Member
|
Before pulling this in the main branch, I need to make sure the modification is OK with the rest of the framework. Here's the issue: the DOS object has mainly been created to be used with the Hilbert transform. Your correction will indeed cure the density() method when you use a non-linear mesh. However, if you were to try to compute a Hilbert transform, it would not work because a linear mesh is still expected. So I think that one should do the things right and go all the way by modifying the code so that also the Hilbert transforms works with non-linear meshes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi all,
I was playing with DOS class and the HilbertTransform. To check that my dos is normalized I used DOS.density() method with mu as a big number.
Right now the integration is done in a following way ( in pytriqs/DOS/DOS.py)
A better solution is to write something like
which I attach as a pull request.