-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
cleaned the procedure for locating maxR #575
Conversation
Nice! For the hyrogenic orbital I was using for a carbon pz = sisl.HydrogenicOrbital(2, 1, 0, Zeff, q0=1.0, R=-0.999999) Output (maxR and the radial function evaluated at that point):
If I don't set the
|
I would discourage overwriting
|
I would have somehow thought the radial function was lower at that percentage integral. I think the normalization is OK. :) |
Ah, now I see what you did. :) Any other suggestions here? |
Oh sorry, I'm just printing information, not overwriting (just wanted to see what is the maxR sisl is finding).
Yes, me too, but I guess is just because we are looking for the R that gets these values for the squared radial function, which is much more localized. |
Not for the moment! For me it looks fine! Let's see if @tfrederiksen has any other suggestions. |
4d2833b
to
7f1aab0
Compare
Codecov Report
@@ Coverage Diff @@
## main #575 +/- ##
==========================================
- Coverage 87.34% 87.31% -0.04%
==========================================
Files 374 374
Lines 47334 47420 +86
==========================================
+ Hits 41345 41403 +58
- Misses 5989 6017 +28
|
7dc13ae
to
f89b533
Compare
Hi Nick, I think there is something weird now in this branch. I was plotting the LDOS maps for benzene using this branch (commit f89b533) and I got these following figures which look very weird to me (the top row are the wavefunctions, just to compare with the obtained LDOS): I am using this orbital pz = sisl.HydrogenicOrbital(2, 1, 0, Zeff, q0=1.0, R=10) to expand the lattice in real space. I compared to what I get with the main branch (using the same grid shape and everything), using version with commit 9e4307b, and I get the following images: It looks like the LDOS changed a lot and also the resolution, which I don't understand. |
Thanks for this @sofiasanz Could you try the latest commit? It should make I believe the problem arose because the integrated quantity was the actual radial integral. Whereas what you see in the wavefunctions are the radial function as is. Now intsead of integrating and finding |
Hmm... Perhaps wait a bit, I need to check some things. |
I like the idea that the user can set a cutoff radius through the specification of a negative By the way, one could also have a function that normalizes the orbital on |
8f5fe0c
to
8ad7d80
Compare
I don't understand the rationale behind |
Yes, this is where I am currently investigating the problems. |
Isn't it not just to solve for |
As @sofiasanz pointed out, the actual function looked a bit weird in the real-space pictures. This I think can be traced to the short I have tried various things, but I think the simplest and acceptable version would be the I have now opted for a different path where users can pass arguments to control the minimization procedure. This can effectively be done like this: R = {
"contains": 0.9999, # contain 99.99% of func integrated
"func": lambda radial, r: radial(r)**2 * r**2, # function to integrate
"maxR": 100, # max searched R distance (integral *must* converge within this range).
}
HydrogenicOrbital(..., R=R) One can still supply a negative number which then translates to Please see the latest commit. |
@sofiasanz could you try with the latest commit to see if the new default is more appropriate? |
I like it :) I think also is much clearer and flexible now. I'll try this commit in the afternoon and plot again the benzene LDOS to compare to what we get with the main branch. What is the default value for |
for Z in [3.2, 4, 5]:
orb = HydrogenicOrbital(2, 1, 0, Z)#, R=-0.999999)
R = np.arange(0, orb.R, 0.001)
r = orb.radial(R)
print("99.99", orb.R, r[-1] / r.max()*100)
orb = HydrogenicOrbital(2, 1, 0, Z, R=-0.999999)
R = np.arange(0, orb.R, 0.001)
r = orb.radial(R)
print("99.9999", orb.R, r[-1] / r.max()*100) yields:
Hope this should be fine enough. The last value shows the percentage of the maximum radial value at the maximum R distance. I.e. 0.025 means that |
I produced this image (using |
But what if you don't specify R? That was the idea. |
Or perhaps in another way, at what minimum R would you find the plots acceptable? :) |
@sofiasanz thanks for your check, I have now added a new commit which should fix the problem, now |
07c5743
to
781abbd
Compare
Yes, I wrote a message before saying that when printing the |
Here I have the images I get with this last commit for I start to get a little weird images in the vicinity of R~2.5 Ang for this effective nuclear charge. And BTW now, even though I use a copy of the geometry the information of the |
Thanks for checking. Just for completeness: import numpy as np
from sisl import HydrogenicOrbital
r = np.arange(0, 10, 0.001)
for Z in [3.2, 4, 5]:
orb = HydrogenicOrbital(2, 1, 0, Z)
R = np.arange(0, orb.R, 0.001)
r = orb.radial(R)
print("99.99 ", Z, orb.R, r[-1] / r.max()*100)
orb = HydrogenicOrbital(2, 1, 0, Z, R=-0.999999)
R = np.arange(0, orb.R, 0.001)
r = orb.radial(R)
print("99.9999", Z, orb.R, r[-1] / r.max()*100) which produces 99.99 3.2 3.888400000000018 0.025069398892111586
99.9999 3.2 5.519599999999978 0.0002567943876730368
99.99 4 3.110700000000002 0.025104120475539306
99.9999 4 4.415699999999987 0.0002569771567260434
99.99 5 2.4886000000000186 0.025104120475539272
99.9999 5 3.5326000000000057 0.00025697715672604347 meaning that the default value produces a |
Instead of searching for a 0 in the radial function we now search for an integration that contians 99.99% of the radial function. The integration uses the trapezoid integration mechanism with f(r)**2*r**3 as that should be normalized for a radial function. This should make it much more stable against different radial function arguments and produce more accurate ranges for the orbitals. Now a warning will be issued when the routine cannot determine a correct R (based on inputs). Ensured that all orbitals with radial functions can pre-calculate the R in case user did not supply it. One can always forcefully set it by supplying it. Signed-off-by: Nick Papior <[email protected]>
This way we can converge faster to a better approach than the current absolute value of the functional integral. Tried functions: 1. f(r) -> problematic when f turns negative 2. f(r) ** 2 -> yields somewhat short R 3. f(r) * r -> problematic when f turns negative 4. (f(r) * r)**2 -> yields too short R 5. f(r)**2 * r**3 -> much better 6. abs(f(r)) -> yields a pretty long tail, but should be fine With the current approach users can manually control the behaviour by supplying a dictionary which passed the arguments to the radial_minimize_range method. Signed-off-by: Nick Papior <[email protected]>
dr argument controls the precision of the integrals. Signed-off-by: Nick Papior <[email protected]>
This ensures that copying does not destroy the R value. Added tests for all orbital classes to ensure it is copied over correctly. Signed-off-by: Nick Papior <[email protected]>
781abbd
to
37e073b
Compare
Instead of searching for a 0 in the radial function we now search for an integration that contians 99.99% of the radial function.
The integration uses the trapezoid integration mechanism with f2*r2 as that should be normalized for a
radial function.
This should make it much more stable against different radial function arguments and produce more accurate ranges for the orbitals.
Now a warning will be issued when the routine cannot determine a correct R (based on inputs).
Ensured that all orbitals with radial functions
can pre-calculate the R in case user did not supply it. One can always forcefully set it by supplying it.
@sofiasanz @tfrederiksen could you please have a look here, this should better adapt the R discovery of your
HydrogenicOrbital
CHANGELOG