Skip to main content

A python toolbox for simulating fast real-time solid-state NMR spectra.

Project description

The Mrsimulator project

Deployment PyPI version PyPI - Python Version
Build Status GitHub Workflow Status Read the Docs
License License
Metrics Total alerts Language grade: Python codecov CodeFactor

Shortly after the birth of Nuclear Magnetic Resonance (NMR) spectroscopy, it was realized that spin and spatial degrees of freedom could be manipulated on a time scale faster than the coherence lifetimes of the nuclear spin transitions. This led to an explosion of multi-pulse and sample reorientation methodologies in magnetic resonance for probing the structure and dynamics of matter over a wide range of length and time scales.

Numerical simulations of the NMR spectra from these methods have long been a critical part of their analyses. The most robust and rigorous numerical approaches employ the full density operator, ideal for dealing with finite pulse effects, weak to intermediate to strong couplings, non-commuting Hamiltonians, and relaxation and exchange processes. However, such approaches can be highly inefficient, particularly when Hamiltonians commute, pulses are ideal, and transverse relaxation can be treated as an ad-hoc line broadening. mrsimulator, an open-source python package, achieves high benchmarks in spectral simulations and analyses by limiting itself to these simpler situations. Fortunately, working within this limit only prevents mrsimulator from modeling spectra of a small fraction of popular NMR methods. The efficiency gains with this approach over conventional density operator simulations are tremendous.

Why use mrsimulator?

  • It is open-source and free.
  • It is a fast and versatile solid-state NMR simulator of one and two-dimensional static, MAS, and VAS spectra of nuclei experiencing chemical shift (nuclear shielding) and quadrupolar coupling interactions.
  • It includes simulations of weakly coupled nuclei experiencing J and dipolar couplings.
  • It is fully documented with a stable and simple API and is easily incorporated into your python scripts and web apps.
  • It is compatible with modern python packages, such as scikit-learn, Keras, etc.
  • Packages using mrsimulator:

Install

pip install mrsimulator

Please refer to our installation documentation for details.

A 1D static and MAS example

from mrsimulator import Simulator, SpinSystem, Site
from mrsimulator.method.lib import BlochDecaySpectrum
import matplotlib.pyplot as plt

# Make Site and SpinSystem objects
H_site = Site(isotope="1H", shielding_symmetric={"zeta": 13.89, "eta": 0.25})
spin_system = SpinSystem(sites=[H_site])

# Make static and MAS one-pulse acquire Method objects
static = BlochDecaySpectrum(channels=["1H"]   )
mas = BlochDecaySpectrum(channels=["1H"], rotor_frequency=1000)  # in Hz

# Setup and run the Simulation object
sim = Simulator(spin_systems=[spin_system], methods=[static, mas])
sim.run()

# Plot the spectra
fig, ax = plt.subplots(1, 2, figsize=(6, 3), subplot_kw={"projection": "csdm"})
ax[0].plot(sim.methods[0].simulation.real, color="black", linewidth=1)
ax[0].set_title("Static")
ax[1].plot(sim.methods[1].simulation.real, color="black", linewidth=1)
ax[1].set_title("MAS")
plt.tight_layout()
plt.show()

This should produce the following figure.


Check out our extensive documentation and more example.

Simulation Fitting


Features

The mrsimulator package currently offers the following

  • Fast simulation of one and two-dimensional solid-state NMR spectra.

  • Simulation of coupled and uncoupled spin system

    • for spin I=1/2, and quadrupole I>1/2 nuclei
    • at arbitrary macroscopic magnetic flux density
    • at arbitrary rotor angles
    • at arbitrary spinning frequency
  • A library of NMR methods,

    • 1D Bloch decay spectrum
    • 1D Bloch decay central transition spectrum
    • 2D Multi-Quantum Variable Angle Spinning (MQ-VAS)
    • 2D Satellite-transition Variable Angle Spinning (MQ-VAS)
    • 2D isotropic/anisotropic sideband correlation spectrum (e.g. PASS and MAT)
    • 2D Magic Angle Flipping (MAF)
    • 2D Dynamic Angle Spinning (DAS)
    • Custom user-defined methods (Method)
  • Models for tensor parameter distribution in amorphous materials.

    • Czjzek
    • Extended Czjzek
    • Custom user-defined models

For more information, refer to the documentation.

Reporting Bugs

Submit bug reports or feature requests on the Github issue tracker.

Discussions are welcome on the Github discussion page.

How to cite

If you use mrsimulator in your publication, please consider citing the following.

  • Deepansh J. Srivastava, Matthew Giammar, Maxwell C. Venetos, Shyam Dwaraknath, Philip J. Grandinetti, & Alexis McCarthy. (2021). mrsimulator: v0.6.1. Zenodo. https://doi.org/10.5281/zenodo.5559730

  • Srivastava DJ, Vosegaard T, Massiot D, Grandinetti PJ (2020) Core Scientific Dataset Model: A lightweight and portable model and file format for multi-dimensional scientific dataset. PLOS ONE 15(1): e0225953. https://doi.org/10.1371/journal.pone.0225953

Additionally, if you use lmfit for least-squares fitting, consider citing the lmfit package. Zenodo. https://doi.org/10.5281/zenodo.4516651

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mrsimulator-0.7.0.tar.gz (337.1 kB view details)

Uploaded Source

Built Distributions

mrsimulator-0.7.0-cp310-cp310-win_amd64.whl (8.9 MB view details)

Uploaded CPython 3.10 Windows x86-64

mrsimulator-0.7.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (10.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

mrsimulator-0.7.0-cp310-cp310-macosx_12_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

mrsimulator-0.7.0-cp310-cp310-macosx_10_9_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

mrsimulator-0.7.0-cp39-cp39-win_amd64.whl (8.9 MB view details)

Uploaded CPython 3.9 Windows x86-64

mrsimulator-0.7.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (10.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

mrsimulator-0.7.0-cp39-cp39-macosx_12_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.9 macOS 12.0+ ARM64

mrsimulator-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

mrsimulator-0.7.0-cp38-cp38-win_amd64.whl (8.9 MB view details)

Uploaded CPython 3.8 Windows x86-64

mrsimulator-0.7.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (11.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

mrsimulator-0.7.0-cp38-cp38-macosx_12_0_arm64.whl (8.6 MB view details)

Uploaded CPython 3.8 macOS 12.0+ ARM64

mrsimulator-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

mrsimulator-0.7.0-cp37-cp37m-win_amd64.whl (8.9 MB view details)

Uploaded CPython 3.7m Windows x86-64

mrsimulator-0.7.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (10.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

mrsimulator-0.7.0-cp37-cp37m-macosx_10_9_x86_64.whl (12.7 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file mrsimulator-0.7.0.tar.gz.

File metadata

  • Download URL: mrsimulator-0.7.0.tar.gz
  • Upload date:
  • Size: 337.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.11

File hashes

Hashes for mrsimulator-0.7.0.tar.gz
Algorithm Hash digest
SHA256 f119e5a4b49d05cd63b01683fc66e5ea7e6aa320bcf38ee914549f94d517e30e
MD5 eb904e6376e472ba028d00fac560d1b1
BLAKE2b-256 6a980f3a181f843324207058f9d6c13f986e40b2e68d08e3a0b1cbd6b00933c0

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ee3fc5685d43d6994fc1735e7dcad22a30c90d7679ac4ae365a66a963160d7df
MD5 3c879ec86cbeee08a3c97f1eacbe47f0
BLAKE2b-256 a2f5069b970183dac91298575faacbaea86c2d1891def9d59ff9d1930004ac7e

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f69631fa353da7cf2572104f1a31c205d2d1927873378a6009945cabc517113d
MD5 86884625381cd29693eb912d6ff5bb22
BLAKE2b-256 a8da9b83aca9bdbac0a951e9436983a3f505ce70ef754d86445635a419d09976

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 5e42aea88f483afcd21ec6ad473abb51dee5e7cc9c834a837f3bdc154394b85d
MD5 6296baada0c954d831d7cf8cb0327a66
BLAKE2b-256 b8df47f3de19f9e1b4fbe74ca72b0d5fe869218cb0c66d854f924c58deb7d3bb

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6dae62fbec88861cd6ab86e9619e133dead7cac142f75084f684609418dd4d2a
MD5 1a785701ed36560ac1740478a94ef89f
BLAKE2b-256 f22c270b77598494e77672350add343c819136b445c4962ba9011105862a2ab1

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5d65ac58fe222c86cc5a92017541c76cab896a6e8762da482dc3b08e5547eaf6
MD5 fcc76b3ddba55107657ddbde95972a6e
BLAKE2b-256 cb12e0e735ceed95ba468526a3259c70b863325f03391c37e02a25a8dd8dabbb

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cc0e14f7814a4748724091391ecf206e7d6c2326555540ee04460129e5f575ab
MD5 8cf8daf33679050678de63b7ba347ce1
BLAKE2b-256 ece65d9771cacaeca47627542d9f6e11f81303e9b041ab82fea60d46e99f41ea

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp39-cp39-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 6f6ca62f443fb95013191d50ddb0083f5f483c9d577a9e402598c060ea95abbc
MD5 1b8d9ab377aec386f4ba24e6ae834d31
BLAKE2b-256 ddab5565d16879b686f89fa1f5be99fbf89001afd5574a6dec37459afa86c9f5

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3b85701943885ac4ec30368bb547dfe0d5ff1a1c087861aae5bc59e75ccc3ba8
MD5 6de07ff5270eb17871fd28f54915aeca
BLAKE2b-256 b1ffad0292f017598c97abfdb5ed5bd07cc64e15adeedac7b2f7e0aed83152f9

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 66323fc5b030f6be4f33311ea0b9d6e11e859ed23a5cfbbbeaea9c96bc6847e7
MD5 8b1ba5b024d466654a9d12ec10076bea
BLAKE2b-256 1d19cee05f4d0360979c6498b4d1edf5e4bc63e2d5a35b57ce0db069faee5d9a

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 40e847e2b1f30f3f9214a24e608273c171d973c61a960d6d2890837b925d142d
MD5 0a19cf73e7d81156478c5046912bb700
BLAKE2b-256 d7a594af3bd841bf1150b114f2271060f0e259f6f650032691ca363c5bf03ac6

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp38-cp38-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp38-cp38-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 3f0a12e3206a1aee28dad819d8ffda36f00edd3631e89962d255bfe3aad35489
MD5 80a5c0c963c9048fe5b7d13a327eb6ee
BLAKE2b-256 a083659eb10cb6047a1ee322c23fa4452d5ef6069b6a8f85c815383e4b0e7d46

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 44396c19df3945fe296f59e727842ace7fa7f1f630db39d590247705914e264b
MD5 bf2aec2640e60ff5e99e5d1a16b72b2e
BLAKE2b-256 468873fbcf196f5c397c8a36b7ba2f1c98210b07531908f23f0a8586df05a682

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a59b208871410da07015c80db8c9457e998b44dd7759ef94b374f9ab6271064c
MD5 ba39c976257f0fe6a036ec785d9320d3
BLAKE2b-256 202bcdebd6064bbfc00e3f301ab3929a6f11005b98f224c33b17cd74d26878c3

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ee65964527efee7a914f2e8241ec714d03d74b6bbc0c45b82fcccd9d3b722f8e
MD5 5a04d4657f32a9b4228be5de99fbe179
BLAKE2b-256 1d0bd3a87939215484cf6a9507f1c0ebdd9f413586d728ab81f1bbff4dc63093

See more details on using hashes here.

File details

Details for the file mrsimulator-0.7.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for mrsimulator-0.7.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4aec42de5bfc8be6ada7fe1ec981ef6215cde69f646e13192fedc99d3c4c4fe2
MD5 0f204df9bce174f46533588929b5d46e
BLAKE2b-256 32f585ddfd80ad63818b5f4f3f5a21a999154040b09645af6ed85a001795d43d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page