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

Angular Channel Code for PairStateInteraction class #186

Open
wants to merge 2 commits into
base: draft_v3.8.0
Choose a base branch
from

Conversation

KarenWadenpfuhl
Copy link

Added code to compute angular channel values for C6 interaction to PairStateInteraction class. Also provides an example Jupyter notebook on how to use the angular channels.

Added angular channel code to PairStateInteraction class and added singleAtomState, compositeState functions to __init__ file to access them for example Jupyter notebook on angular channel code.
Example upyter notebook for angular channel code.
@nikolasibalic nikolasibalic self-requested a review December 19, 2024 10:58
@nikolasibalic nikolasibalic force-pushed the master branch 9 times, most recently from 8cde825 to 9583e0d Compare December 26, 2024 17:30
@nikolasibalic nikolasibalic added this to the v3.8.0 milestone Dec 27, 2024
@nikolasibalic nikolasibalic changed the base branch from master to draft_v3.8.0 January 5, 2025 10:32
# and enforce additional quadrupole selection rules
elif ((self.interactionsUpTo == 2)
and (abs(l-l1) in [0,2])
and (abs(j-j1) in [0,1,2])
Copy link
Owner

Choose a reason for hiding this comment

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

better abs(round(j-j1)) since j and j1 are float.

# forbidden for dipole allowed only, even when setting interactionsUpTo=1
r"""
Checks if a pair of angular momentum quantum numbers (l,j) and (l1, j1) is
coupled.
Copy link
Owner

Choose a reason for hiding this comment

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

maybe add in docstring for clarity

via dipole or up to quadrupole transitions (for `self.interactionsUpTo=1` and `self.interactionsUpTo=1` respectively)

Copy link
Owner

@nikolasibalic nikolasibalic left a comment

Choose a reason for hiding this comment

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

Looks overall very nice. Thank you for your contribution @KarenWadenpfuhl !

Don't worry for now about formatting issue in CI/CD (I will fix formatting once it is merged to draft branch, before moving to main).

In addition to few questions above, the main remaining thing is to decide what to do with precalculated data.

I suggest that we create a folder ~/.arc-data/C6_LJ_channels_cache. Since neither GitHub nor PyPI is used for distribution and storage of large data sets, I suggest that we store all the datasets in Zenodo. Then your code upon execution could check if in ~/.arc-data/C6_LJ_channels_cache/ you have the correct file or not. If a file is not found, it would write in the terminal option to the user: it would automatically download from Zenodo fixed dataset or run pre-calculation based on the latest values of atom data (using a rich progress bar, it will automatically indicate estimated time also). After that it would proceed.

I can help you add that logic and download, once you create the Zenodo dataset and point me precisely where the check and download should happen.

Regarding data files on Zenodo, to get compact files we should use something binary instead of .txt. Numpy binary .npy is one choice.

From a scientific long term reuse and compactness point of view, probably the best choice would be battle tested, age-old standard HDF5 (see here and here), that you can easily manipulate from Python using hd5py and where you can also write all metadata etc. What do you prefer? I am happy to help with data wrangling.

# so wrote a new one that enforces the selection rules as stated here for LS coupling:
# https://en.wikipedia.org/wiki/Selection_rule
# also, have a second look at _isCoupled fct but I think it returns states that are
# forbidden for dipole allowed only, even when setting interactionsUpTo=1
Copy link
Owner

Choose a reason for hiding this comment

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

Do you have example for when you observe incorrect behavior? I reviewed again the code and I think conditions are identical.

"""
if self.interactionsUpTo == 2:
print("WARNING: The quadrupole interaction currently seems to yield bad results.\n"
"Go back and have a look at this!")
Copy link
Owner

Choose a reason for hiding this comment

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

Any more info? Should we take a look into this?

first basis above, then basis with the
atomStates interchanged.
"""
# [copied WignerD rotation stuff from Nikola's code and amended as required]
Copy link
Owner

Choose a reason for hiding this comment

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

you can suppress this comments about code reuse ;)

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

Successfully merging this pull request may close these issues.

2 participants