-
Notifications
You must be signed in to change notification settings - Fork 18
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
Expose matrix element calculation #27
Comments
Is the |
that calculates the information I want, but IMHO is not usefully exposed. The docstring says:
I am not sure what this ambiguous prefactor is. I am looking for a function that takes the state indices that I want to couple, and gives a dipole matrix element in terms of (eg) e*a0 (so matrix elements are ~unity) |
What we do is clarified in one of my pull requests for documentation #10, which describes the physics conventions used in the package. Section 1.4.1 is probably of most relevance. This will explain what is meant by slightly confusing docstring. |
Triaging, I see a couple of separate issues here.. First off is normalization factors: agree on the correct definition of the dipole matrix elements (IIRC there are a few different conventions in use in the literature); check the physics notes are consistent with it and merge that PR; update the docstring to be clearer (likely just cross-referencing the physics part of the manual); update the code to use the correct normalization factor. |
Second up is the interface....
Are we satisfied with just documenting the members of Are we satisfied with users writing code like Right now (but I'm happy to be convinced otherwise), I think I'd prefer to just improve the documentation (and add more examples and tests) but not add accessor functions to the main I do however feel like calculating Stark shifts is a common enough job -- and definitely the kind of thing that I want this package to do -- that we should provide tools for it. |
What's quite nice is that right now a lot of the sums you want to do are relatively trivial by using the methods already provided by the ion class to generate slices into the |
This is close to true, but not quite. For example, one needs to manually call calc_ePole() AFAICT, then index into an undocumented variable... IMHO as well as documenting, it would be really useful to have a dipole_matrix_element(initial state index, final state index) method |
Yes, that all needs to be documented. We should also revisit the chain of what calls what and see if it's sensible (e.g. if you pass a B-field into the constructor then it calls Originally I didn't want to get the code to calculate the E/M-pole elements by default to keep the initialization time low. However, IIRC last time I bench marked it, the time it takes to calculate those elements is pretty low* and arguably the time saving isn't worth the hassle of having to call them manually.
|
That feels like API bloat to me. As a compromise, I'd be happy to have |
I am happy as long as the accessor function is nicely documented, an ideally returns in standard units (e.g. units of e*a0) rather than something that has to be rescaled by the user to be useful |
Good! So, I think the list of actions arising out of this issue are then:
Will that make everyone happy? Volunteers to help with any of this (particularly reviewing the docs/moving into a nicer format than latex)? |
For point 3: |
@cjbe thinking about this more, the API bloat isn't as bad as I'd feared. We just need to have accessors that can support: an index; a slice; a Level. I already do that for populations (https://github.com/OxfordIonTrapGroup/ion_phys/blob/8a4fc96e531332391a871617ed102166d9b5323b/ion_phys/common.py#L204 ) and it's fine. So, really we should just provide accessors like that for every matrix. That also allows the entire matrix to be returned by passing in slices as:
|
For reference, the correct normalisation for my standard conventions is: D = np.sqrt( ion.Gamma[i,j] * 3*np.pi*ct.epsilon_0*ct.hbar*ct.c**3/(ion.get_frequency(i,j)**3) ) |
Thanks! |
@RHanley1 does this agree with the convention you used in your notes? |
Yes, I think my notes is where @cjbe got it from. The only thing to note here is that what I have written in the notes is D = <j|r|i>. So one needs to multiple what I have defined in the notes by e to get the conventional D = <j|er|i> dipole matrix element. |
Good! (Sorry for not reviewing the notes yet, they're a big positive contribution so I want to get that done, just haven't found the time). This is quick so I'll likely get to it over the weekend. |
Indeed - Ryan's notes were consistent with what I expected, and allowed to me work out what the variables actually were |
Related: does anyone with with experience setting up documentation builds want to give me a hand converting the notes to markdown and setting the build + hosting up? |
It would be useful to expose the matrix element calculations in a user friendly and documented way.
For example, if I want to calculate Stark shifts on state |s> from a laser beam, I need to sum over |<e|d|s>|^2/Delta for all |e> that couple to |s> - this would be easy in the current framework if there was a neat way to evaluate <e|d|s>.
This similarly occurs for Raman rates, like Rabi frequency (<e|d|dn><e|d|up>/Delta summing over all connected |e>) or scattering / dephasing rates.
The text was updated successfully, but these errors were encountered: