diatomic-py


Namediatomic-py JSON
Version 2.0.0 PyPI version JSON
download
home_page
SummaryA package for calculating rotational and hyperfine structure of singlet diatomic molecules.
upload_time2024-01-20 13:50:03
maintainer
docs_urlNone
author
requires_python>=3.10
licenseCopyright (c) 2021, Jacob A Blackmore Copyright (c) 2023, Tom Hepworth Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords quantum singlet diatomic molecules hyperfine hamiltonian
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            diatomic-py
===========

.. image:: https://github.com/durham-qlm/diatomic-py/actions/workflows/code_quality.yml/badge.svg?event=push&branch=master
    :alt: Code Quality Status
    :target: https://github.com/durham-qlm/diatomic-py/actions/workflows/code_quality.yml

.. image:: https://github.com/durham-qlm/diatomic-py/actions/workflows/test-suite.yml/badge.svg?event=push&branch=master
    :alt: Test Suite Status
    :target: https://github.com/durham-qlm/diatomic-py/actions/workflows/test-suite.yml

Python package to calculate the hyperfine energy levels of singlet sigma diatomic molecules (e.g. RbCs, KCs and KRb) under various applied fields.
The hyperfine structure can be calculated in static electric and magnetic fields and, when provided the polarisability, oscillating electric fields.

More detailed information can be found in the documentation at https://diatomic-py.readthedocs.io .

Diatomic-py is licensed under a BSD 3 clause license, a copy can be found `here <LICENSE>`_.

If you use our work for academic purposes you can cite us using:

J.A.Blackmore *et al.* Diatomic-py: A python module for calculating the rotational and hyperfine structure of :math:`^1\Sigma` molecules, [Arxiv *e-prints* 2205.05686](https://arxiv.org/abs/2205.05686) (2022).

This work has continued to evolve since the release of the paper, and so the API is different.

PyPi Installation
-----------------
This form of the package is not currently available on PyPI

Manual Installation
-------------------
Clone the repository:

.. code-block:: shell

    git clone https://github.com/durham-qlm/diatomic-py.git
    cd diatomic-py

It is recommended to then install the python package into virtual environment:

.. code-block:: shell

    # You may need to substitute `python` for `python3` if you're on macOS
    python -m venv ./venv
    source ./venv/bin/activate
    # After activating the virtual env you should only need `python`
    python --version
    which python

The below installation commands assume you are active in such an environment.
You can then install the package, there are various options indicated inside
the square brackets for the command types:

.. code-block:: shell

    # Installs essentials + matplotlib
    python -m pip install ".[plotting]"

    # OR if you also want to run test suite:
    python -m pip install ".[test,plotting]"
    pytest

    # OR if you want to develop code for the package
    python -m pip install -e ".[dev,plotting]"
    pre-commit install


Example
-------
.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt
    import scipy.constants

    from diatomic.systems import SingletSigmaMolecule
    import diatomic.operators as operators
    import diatomic.calculate as solver

    GAUSS = 1e-4  # T
    MHz = scipy.constants.h * 1e6

    # Generate Molecule
    mol = SingletSigmaMolecule.from_preset("Rb87Cs133")
    mol.Nmax = 2

    # Generate Hamiltonians
    H0 = operators.hyperfine_ham(mol)
    Hz = operators.zeeman_ham(mol)

    # Parameter Space
    B = np.linspace(0.001, 300, 50) * GAUSS

    # Overall Hamiltonian
    Htot = H0 + Hz * B[:, None, None]

    # Solve (diagonalise) Hamiltonians
    eigenenergies, eigenstates = solver.solve_system(Htot)

    # Plot results
    fig, (ax_up, ax_down) = plt.subplots(2, 1, sharex=True)

    ax_down.plot(B / GAUSS, eigenenergies[:, 0:32] / MHz, c="k", lw=0.5, alpha=0.3)
    ax_up.plot(B / GAUSS, eigenenergies[:, 32:128] / MHz, c="k", lw=0.5, alpha=0.3)

    ax_down.set_xlabel("Magnetic Field (G)")
    fig.supylabel("Energy / h (MHz)")

    plt.show()


.. image:: static/example_plot.png
  :width: 800
  :alt: Resulting plot of above example

For more examples of usage, see the ``./examples`` folder.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "diatomic-py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "quantum,singlet,diatomic,molecules,hyperfine,hamiltonian",
    "author": "",
    "author_email": "Jake Blackmore <j.a.blackmore@durham.ac.uk>, Tom Hepworth <tom.hepworth@durham.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/06/34/51a40da4e385dcddb2eb9b8035438057d57cfb95dcf04d4d5d58f18212b9/diatomic-py-2.0.0.tar.gz",
    "platform": null,
    "description": "diatomic-py\n===========\n\n.. image:: https://github.com/durham-qlm/diatomic-py/actions/workflows/code_quality.yml/badge.svg?event=push&branch=master\n    :alt: Code Quality Status\n    :target: https://github.com/durham-qlm/diatomic-py/actions/workflows/code_quality.yml\n\n.. image:: https://github.com/durham-qlm/diatomic-py/actions/workflows/test-suite.yml/badge.svg?event=push&branch=master\n    :alt: Test Suite Status\n    :target: https://github.com/durham-qlm/diatomic-py/actions/workflows/test-suite.yml\n\nPython package to calculate the hyperfine energy levels of singlet sigma diatomic molecules (e.g. RbCs, KCs and KRb) under various applied fields.\nThe hyperfine structure can be calculated in static electric and magnetic fields and, when provided the polarisability, oscillating electric fields.\n\nMore detailed information can be found in the documentation at https://diatomic-py.readthedocs.io .\n\nDiatomic-py is licensed under a BSD 3 clause license, a copy can be found `here <LICENSE>`_.\n\nIf you use our work for academic purposes you can cite us using:\n\nJ.A.Blackmore *et al.* Diatomic-py: A python module for calculating the rotational and hyperfine structure of :math:`^1\\Sigma` molecules, [Arxiv *e-prints* 2205.05686](https://arxiv.org/abs/2205.05686) (2022).\n\nThis work has continued to evolve since the release of the paper, and so the API is different.\n\nPyPi Installation\n-----------------\nThis form of the package is not currently available on PyPI\n\nManual Installation\n-------------------\nClone the repository:\n\n.. code-block:: shell\n\n    git clone https://github.com/durham-qlm/diatomic-py.git\n    cd diatomic-py\n\nIt is recommended to then install the python package into virtual environment:\n\n.. code-block:: shell\n\n    # You may need to substitute `python` for `python3` if you're on macOS\n    python -m venv ./venv\n    source ./venv/bin/activate\n    # After activating the virtual env you should only need `python`\n    python --version\n    which python\n\nThe below installation commands assume you are active in such an environment.\nYou can then install the package, there are various options indicated inside\nthe square brackets for the command types:\n\n.. code-block:: shell\n\n    # Installs essentials + matplotlib\n    python -m pip install \".[plotting]\"\n\n    # OR if you also want to run test suite:\n    python -m pip install \".[test,plotting]\"\n    pytest\n\n    # OR if you want to develop code for the package\n    python -m pip install -e \".[dev,plotting]\"\n    pre-commit install\n\n\nExample\n-------\n.. code-block:: python\n\n    import numpy as np\n    import matplotlib.pyplot as plt\n    import scipy.constants\n\n    from diatomic.systems import SingletSigmaMolecule\n    import diatomic.operators as operators\n    import diatomic.calculate as solver\n\n    GAUSS = 1e-4  # T\n    MHz = scipy.constants.h * 1e6\n\n    # Generate Molecule\n    mol = SingletSigmaMolecule.from_preset(\"Rb87Cs133\")\n    mol.Nmax = 2\n\n    # Generate Hamiltonians\n    H0 = operators.hyperfine_ham(mol)\n    Hz = operators.zeeman_ham(mol)\n\n    # Parameter Space\n    B = np.linspace(0.001, 300, 50) * GAUSS\n\n    # Overall Hamiltonian\n    Htot = H0 + Hz * B[:, None, None]\n\n    # Solve (diagonalise) Hamiltonians\n    eigenenergies, eigenstates = solver.solve_system(Htot)\n\n    # Plot results\n    fig, (ax_up, ax_down) = plt.subplots(2, 1, sharex=True)\n\n    ax_down.plot(B / GAUSS, eigenenergies[:, 0:32] / MHz, c=\"k\", lw=0.5, alpha=0.3)\n    ax_up.plot(B / GAUSS, eigenenergies[:, 32:128] / MHz, c=\"k\", lw=0.5, alpha=0.3)\n\n    ax_down.set_xlabel(\"Magnetic Field (G)\")\n    fig.supylabel(\"Energy / h (MHz)\")\n\n    plt.show()\n\n\n.. image:: static/example_plot.png\n  :width: 800\n  :alt: Resulting plot of above example\n\nFor more examples of usage, see the ``./examples`` folder.\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2021, Jacob A Blackmore Copyright (c) 2023, Tom Hepworth  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "A package for calculating rotational and hyperfine structure of singlet diatomic molecules.",
    "version": "2.0.0",
    "project_urls": null,
    "split_keywords": [
        "quantum",
        "singlet",
        "diatomic",
        "molecules",
        "hyperfine",
        "hamiltonian"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ae24e227ba95b7d534150529100d03fa4493645d4d666495023fb6081519e1a1",
                "md5": "5c4e6e6ade3e0a724e7d0bd0a399c475",
                "sha256": "d5af50ddde58e88918731ee76b3a38fcf42a3b324673a3cbbcb3c015b06884fb"
            },
            "downloads": -1,
            "filename": "diatomic_py-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c4e6e6ade3e0a724e7d0bd0a399c475",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 21185,
            "upload_time": "2024-01-20T13:50:00",
            "upload_time_iso_8601": "2024-01-20T13:50:00.845084Z",
            "url": "https://files.pythonhosted.org/packages/ae/24/e227ba95b7d534150529100d03fa4493645d4d666495023fb6081519e1a1/diatomic_py-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "063451a40da4e385dcddb2eb9b8035438057d57cfb95dcf04d4d5d58f18212b9",
                "md5": "8541205f496bf5fe72cc21593d6935a9",
                "sha256": "908246de5820f75259846d9992a90cade13e0d1c2694fe592bf2744f4e82bb6d"
            },
            "downloads": -1,
            "filename": "diatomic-py-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8541205f496bf5fe72cc21593d6935a9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 23945,
            "upload_time": "2024-01-20T13:50:03",
            "upload_time_iso_8601": "2024-01-20T13:50:03.068852Z",
            "url": "https://files.pythonhosted.org/packages/06/34/51a40da4e385dcddb2eb9b8035438057d57cfb95dcf04d4d5d58f18212b9/diatomic-py-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-20 13:50:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "diatomic-py"
}
        
Elapsed time: 2.44560s