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

Out-source n!/k! to Combinatorics.jl #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Out-source n!/k! to Combinatorics.jl #7

wants to merge 2 commits into from

Conversation

jagot
Copy link
Member

@jagot jagot commented Jul 8, 2020


@@ -50,7 +50,7 @@ function radial_dipole_moment(a::Orbital, b::Orbital)
n == n′ && return 3/2*n*√(n^2-ℓ^2)

A = powneg1(n′-ℓ)/(4*factorial(2ℓ-1))
B = √(factorial_ratio(n+ℓ,n-ℓ-1)*factorial_ratio(n′+ℓ-1,n′-ℓ))
B = √(factorial(n+ℓ,n-ℓ-1)*factorial(n′+ℓ-1,n′-ℓ))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the gamma function from SpecialFunctions be better here, for the high n/ell cases?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually unsure, when talking about ratios of factorials. Should be investigated. This is of course related to #2, however, a numerically stable evaluation of the formula will not help for arbitrarily large values of n/ell, anyway, since the dipole moments (in the length gauge) are analytically divergent. This is physically reasonable, since the matrix element is ~ <n' ell' | r | n ell>, which of course will increase, the larger the values of the quantum numbers are.

@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #7 (abf9519) into master (b92a18f) will decrease coverage by 10.09%.
The diff coverage is 5.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master       #7       +/-   ##
===========================================
- Coverage   32.00%   21.90%   -10.10%     
===========================================
  Files           6        5        -1     
  Lines         100      105        +5     
===========================================
- Hits           32       23        -9     
- Misses         68       82       +14     
Impacted Files Coverage Δ
src/Hydrogen.jl 100.00% <ø> (ø)
src/orbitals.jl 29.62% <0.00%> (-70.38%) ⬇️
src/dipoles.jl 46.66% <100.00%> (+2.91%) ⬆️
src/energies.jl 0.00% <0.00%> (ø)
src/sparse_builder.jl 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b92a18f...abf9519. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants