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

dr is constant; move outside loop #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions starkhelium/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def wf_numerov(n, l, nmax, rmin, step):
# Numerov method
i += 1
r = r_sub1
drr = exp(-step)**(-l - 1) - 1.0
while r >= rmin:
## next step
r = rmax * exp(-i*step)
Expand All @@ -218,16 +219,14 @@ def wf_numerov(n, l, nmax, rmin, step):
## check for divergence
if r < r_in:
dy = abs((y - y_sub1) / y_sub1)
dr = (r**(-l-1) - r_sub1**(-l-1)) / r_sub1**(-l-1)
if dy > dr:
if dy > drr:
break

## store vals
rvals.append(r)
yvals.append(y)

## next iteration
r_sub1 = r
g_sub2 = g_sub1
g_sub1 = g
y_sub2 = y_sub1
Expand Down