Skip to main content

Solve Maxwell's equations for a cluster of particles using the generalized multiparticle Mie theory (GMMT)

Project description

MiePy

MiePy is a Python module for the generalized multiparticle Mie theory (GMMT), also known as the aggregate T-matrix method. MiePy solves the electrodynamics of a collection of spherical or non-spherical scatterers with an arbitrary incident source.

Electric field visualization
Electric field around a 37 particle cluster

Three particle system
3D electric field contours around three metal nanoparticles

Features

  • Non-spherical particles using the T-matrix formulation via the extended boundary condition method (EBCM). Includes cylinders, spheroids, ellipsoids, cubes and polygonal prisms
  • Arbitrary incident sources (plane waves, Gaussian beams, HG and LG beams, point dipoles)
  • Evaluation of cluster cross-sections and optical force and torque on individual particles
  • Periodic boundary conditions with various lattice types (square, hexagonal, etc.) and mirror and discrete rotational symmetries for faster calculations
  • Optional planar interface (substrate)
  • 3D scene visualization using the VPython library
  • Image clusters using a simulated microscope
  • OpenMP parallelization for systems with larger numbers of particles

Installation

pip install miepy

If using uv:

uv venv --python 3.13
uv pip install miepy
source .venv/bin/activate

GPU Backend (optional)

To use the GPU-accelerated solver backend:

pip install miepy[gpu]

Then activate the GPU backend:

import miepy
miepy.backends.set_backend('gpu')

Usage

See the examples folder for how to use MiePy.

Run any of the available examples without explicit installation using uv:

Command Description
uvx miepy dielectric_sphere Dielectric sphere scattering and cross-sections
uvx miepy ag_sphere Silver sphere scattering and absorption
uvx miepy ag_shell Core-shell particle scattering
uvx miepy vary_index Scattering intensity vs wavelength and refractive index
uvx miepy fields Electric and magnetic field visualization
uvx miepy dimer_scattering Au dimer cross-sections
uvx miepy dimer_force Force and torque on dimer particles
uvx miepy far_field Far-field radiation patterns
uvx miepy whispering_gallery Whispering gallery modes in dielectric sphere
uvx miepy focused_gaussian Focused Gaussian beam with orbital angular momentum
uvx miepy imaging Near-field, far-field, and microscope imaging

For an overview of the theory, see docs folder.

Install from source

MiePy uses vcpkg for C++ dependency management and uv for Python management, which simplifies building across platforms.

Prerequisites:

  • GCC
  • uv

Build steps:

  1. Clone MiePy and its submodules:
git clone https://github.com/johnaparker/miepy.git miepy --recurse-submodules && cd miepy
  1. Bootstrap vcpkg (first time only):
./vcpkg/bootstrap-vcpkg.sh
  1. Install MiePy using uv:
uv sync
  1. Optionally, run the tests to verify correctness:
uv run pytest tests

License

MiePy is licensed under the terms of the GPLv3 license.

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

miepy-1.1.0.tar.gz (7.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

miepy-1.1.0-cp313-cp313-win_amd64.whl (8.5 MB view details)

Uploaded CPython 3.13Windows x86-64

miepy-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

miepy-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

miepy-1.1.0-cp313-cp313-macosx_15_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

miepy-1.1.0-cp312-cp312-win_amd64.whl (8.5 MB view details)

Uploaded CPython 3.12Windows x86-64

miepy-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

miepy-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

miepy-1.1.0-cp312-cp312-macosx_15_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

miepy-1.1.0-cp311-cp311-win_amd64.whl (8.5 MB view details)

Uploaded CPython 3.11Windows x86-64

miepy-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

miepy-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

miepy-1.1.0-cp311-cp311-macosx_15_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file miepy-1.1.0.tar.gz.

File metadata

  • Download URL: miepy-1.1.0.tar.gz
  • Upload date:
  • Size: 7.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fbe304b54062d4737c299487004c6caf768d0a598326eaf1d17c975557ac2e35
MD5 2e81396391f67876826558c7faa88c16
BLAKE2b-256 8557eb60b5244e0341a4116bf208e20e3cadfcbc0c146f43334712db996e4c9a

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 8.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 16a96ed7168481fea3e4acfb377053e0c1039099c6b89750657d3fa56cba55f5
MD5 3d930cde3f7e2a5f5d88751f36bbc7aa
BLAKE2b-256 ead58db93933b67fa843bde0be1e1441e10eeaa72021f960fb8623d6bf89465f

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c45c3ad1c99a376048f1dd06735b81b79a09f6384b1f7167a3c70ddc57d833d0
MD5 bd821aef56f35b05a2a1171c7cd1e939
BLAKE2b-256 6e71300f50ea14790e3443e74044f0b6944bb7092233ef701879cfacf680c4e4

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: CPython 3.13, macOS 15.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 a3239bda42e4810f3f15f4d01760f3203e4403bdf1375f3c8d48de11ba099100
MD5 de68b8e875de1950bddbd03bcd686140
BLAKE2b-256 4287ecb5ddc1f6e913a89e894da60a626bdeff93d999dc5df25d65e8320a8c61

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp313-cp313-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 6.6 MB
  • Tags: CPython 3.13, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 165d9e83f7b9b76eaa99770b1e42449f8319fc0fd4b9ab6bba837d2b72a69c15
MD5 7d483eb656c32911d85d295d34aa884c
BLAKE2b-256 b659961793a5b608c42bfd419c22aead56b69f9d2d6aea7cdf4fbbc7ddefc368

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 8.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5ad486ffebe4d09519628b8f084d6348ccf4bc6dcb0a5d7a9a28f935d5d4ace8
MD5 0edbd804a3b0f401a58ed3c267445a6c
BLAKE2b-256 0b45fc46e591d119167788fdbd6532d59c43531f7ec4c2ac8f31b2dcab5e795d

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3c35171f8502c4229c3bb28d6ab6a1795e20f6ebb60abed14012065ab0ba6320
MD5 a6e5e79a9857ab4981c6ad3fe9eb32d6
BLAKE2b-256 5a2bb245f757d86553043a5132ebaceba2319d413298737becb1c9fcfa8be670

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: CPython 3.12, macOS 15.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 29307133a1c9ae363dca38d857a7491e2ef56f27ab4b40dd1f94f91d3ff727a4
MD5 f13c7c21b9aa418a369160108f3a3560
BLAKE2b-256 1412fcbdf50b9e0aedf9cd752bc0d66f45489c49e77d5558d7bd7ed6dad0043d

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp312-cp312-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 6.6 MB
  • Tags: CPython 3.12, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0f3cbfd9ad1f0d7dcb22a50db9cce25d237e97fca7778be136636b35eeca61ec
MD5 fa33390ee42e2611de2fceb2bfd5a6b0
BLAKE2b-256 256b8e9adf8e3fd5743241c66717953021ba36dd3ffcea83238e21f676691a0a

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 8.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ac5be2e3b90a58334c0759d152e8295a6ded99e1d4b583204499613d4c36e413
MD5 e76a6a7b28c98c116bc1763112dd14ec
BLAKE2b-256 23c1d525fe07db00d4fd9554ece1de29354f0ad7c9bb7248c24f3de2bca77fe4

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b840b5cddc17a80de63280a4dfa504bdc5ff4228f4ed9af8b78d457b98eb0d04
MD5 2c999195983a3943064b6b241952ed24
BLAKE2b-256 1bbaf35c14bd2f47b3f61bd45b84499c77aebab73666b779ff2b1dc9583ec43c

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: CPython 3.11, macOS 15.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 b9280cbb6068e361fd1243a6783a48f94ff94840cf12ddbb8045533df22609f0
MD5 f95e631a1e66db27fc4610d3d2e67ea7
BLAKE2b-256 5050953e35f6f13757bcc5a6ee788e9b1991904d24fc8cc5603898751460776a

See more details on using hashes here.

File details

Details for the file miepy-1.1.0-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

  • Download URL: miepy-1.1.0-cp311-cp311-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 6.6 MB
  • Tags: CPython 3.11, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for miepy-1.1.0-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ef6d76c2b5d4aecb23bcfa887257ad8bf179b4336fd335f0879fc0a5fcc20eee
MD5 8a3a228ae4dd4658af13b42aed4eb9fe
BLAKE2b-256 334ca2e2df0d5852837f2436add6288329ff933145ceef7c9a1d66571555ac42

See more details on using hashes here.

Supported by

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