Skip to content

Releases

v0.5.0

Choose a tag to compare

@maroba maroba released this 22 Oct 12:08

Added

  • MultipoleExpansion.field(x, y, z): the field E = -∇Φ, computed analytically.
  • center argument to expand about any point instead of the center of charge. This makes interior
    expansions possible where the center of charge coincides with a charge.
  • validity_radius and is_valid(x, y, z): where the expansion converges.
  • ExpansionValidityWarning when evaluating the expansion where it does not converge, and the
    charge_tol argument to control how much of a continuous charge density may be neglected for this check.
  • dipole_moment and quadrupole_moment: the cartesian dipole vector and traceless quadrupole tensor.
  • total_charge for discrete charge distributions (previously only for continuous ones).
  • multipole_moments_array: the multipole moments as array, indexed by [l, m].
  • A readable repr, type hints for the public API, and ExpansionValidityWarning,
    InvalidChargeDistributionException and InvalidExpansionException exported from multipoles.

Changed

  • Much faster: computing the moments of a 101³ grid takes 0.17 s instead of 2.4 s for l_max=4, and
    0.3 s instead of 24 s for l_max=10. Evaluating the expansion is about 20 times faster.
  • Evaluating the potential at points inside the charge distribution (exterior expansion) or outside of it
    (interior expansion) now emits an ExpansionValidityWarning. This includes evaluating on the whole grid
    with Phi[:, :, :]. The results there were never meaningful.
  • total_charge of continuous charge distributions is now integrated with Simpson's rule, consistent with the
    multipole moments, instead of a plain sum over the grid.
  • multipoles no longer uses scipy.special for the spherical harmonics.

v0.4.2

Choose a tag to compare

@maroba maroba released this 22 Oct 11:08

Bug-fix release.

  • Fix import error with SciPy >= 1.17 (sph_harm was removed)
  • Phi(x, y, z, l_max=...) now respects l_max
  • exterior=False now selects the interior expansion
  • Phi[...] respects interior expansions and no longer mutates internal state
  • Clear errors for zero total charge, charge at the center of an interior expansion,
    and invalid grids (e.g. meshgrid without indexing='ij')
  • Descending grids are supported
  • Evaluation is vectorized and accepts arrays of any (broadcastable) shape
  • Requires Python >= 3.9

v0.3.0: Internal multipole expansion

Choose a tag to compare

@maroba maroba released this 15 Sep 15:36

So far, multipoles could only handle external multipole expansions. This release adds the internal multipole expansion.

Special thanks to Dylan Madisetti @dmadisetti who implemented this feature.