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

Repeated calls of LevelPlot.makeLevels #4

Closed
kwnminho opened this issue Dec 30, 2016 · 1 comment
Closed

Repeated calls of LevelPlot.makeLevels #4

kwnminho opened this issue Dec 30, 2016 · 1 comment
Assignees

Comments

@kwnminho
Copy link

kwnminho commented Dec 30, 2016

Hi I'm walking through the primer and found something worth mentioning.

Everytime makeLevels function is called, it appends the lists of labels. If one calls the function again, it will append another entries, possibly allowing duplicated ones. I found this feature to be useful yet requires some caution.

Say we have a code

nmin=5  #Minimum n
nmax=5 #Maximum n
lmin=0  #Minimum l
lmax=1  #Maxmium l

atom=Rubidium()
levels = LevelPlot(atom)
levels.makeLevels(nmin,nmax,lmin,lmax)
print levels.levelLabel

This yields [[5, 0, 0.5], [5, 1, 0.5], [5, 1, 1.5]].

If it goes through another run, levelLabel will have [[5, 0, 0.5], [5, 1, 0.5], [5, 1, 1.5], [5, 0, 0.5], [5, 1, 0.5], [5, 1, 1.5]]

I believe this behavior is intended and nothing wrong. Actually it can be utilized to include multiple levels which cannot be handled my a single execution of makeLevels. Say one wants to see energy levels above the ground state Rb 5s_{1/2}, including 4d. Although 4d is more energetic, it will be not covered by makeLevels if one specifies nmin=5. Putting nmin=4 will force the code to draw 4s_{1/2}, leading to non-physical result. Therefore workaround I use is

nmin=5  #Minimum n
nmax=5 #Maximum n
lmin=0  #Minimum l
lmax=2  #Maxmium l

levels.makeLevels(4,4,2,2)
levels.makeLevels(nmin,nmax,lmin,lmax)

This will give levels [[4, 2, 1.5], [4, 2, 2.5], [5, 0, 0.5], [5, 1, 0.5], [5, 1, 1.5], [5, 2, 1.5], [5, 2, 2.5]] and it is what I intended to get.

In the future it might be more failsafe to add an initializing function, which empties existing labels. I had to restart kernel in order to draw new level plots.

@nikolasibalic nikolasibalic self-assigned this Jan 2, 2017
@nikolasibalic
Copy link
Owner

Hi @kwnminho, thank you for the feedback.

There were several bugs in implementation. I will add an update that should resolve this. The behaviour after the update should be the following:

  1. When you call a new LevelPlot(), initialization functions returns a new, clear level plot.
  2. In your example putting nmin=4 for Rubidium should not force the printing of unphysical levels, but only levels like n=4 l=2, that have higher energies.

With this updates, you can obtain the indented level plot with:

nmin=4
nmax=5
lmin=0
lmax=2
levels.makeLevels(nmin,nmax,lmin,lmax)

This will give now [[5, 0, 0.5], [5, 1, 0.5], [5, 1, 1.5], [5, 2, 1.5], [5, 2, 2.5], [4, 2, 2.5], [4, 2, 1.5]].

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

No branches or pull requests

2 participants