Feat: Add support for spin-1 nuclei #30
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request introduces significant enhancements to
nmrsim
to enable the simulation of spin-1 nuclei as well as mixed-spin systems, such as those involving both proton (1H) and deuterium (2H) nuclei.Key Changes & Features:
SpinSystem
: TheSpinSystem
class now accepts a spin quantum number array (s
) during initialization, allowing for accurate Hamiltonian construction and peaklist generation for systems with different nuclear spins (e.g., I=1/2 for 1H, I=1 for 2H) or the same nuclear spins (e.g., two 2H atoms I=1).ppm_to_hz_from_nuclei_info
Function: A new utility function,ppm_to_hz_from_nuclei_info
, has been added to simplify input by converting chemical shift values in ppm to Hz, correctly accounting for the specific gyromagnetic ratios of different nucleus types.reduce_peaks
Function Enhancement: Thereduce_peaks
function has been updated to robustly handlenp.ndarray
inputs, improving its general usability.Validation & Testing:
tests/test_mixed_spin_systems.py
.@pytest.mark.xfail
tests intest_qm.py
continue to behave as expected (failing due to known sparse array boolean conversion issues, unrelated to this feature).Other Changes:
*.npz
files to.gitignore
to prevent generated binary cache files from being tracked in version control.Potential Documentation Update:
This new functionality would benefit from being documented on the Sphinx page. I am available to assist with writing or clarifying examples if guidance on the documentation structure is provided.