API Reference
multipoles.MultipoleExpansion
Perform a multipole expansion for a given charge or mass distribution.
Determines the spherical multipole moments of the given distribution and can calculate the solution of the electrostatic or gravitational potential based on the multipole expansion.
Create it from point charges with MultipoleExpansion.from_charges, from a charge
density on a grid with MultipoleExpansion.from_density, from known moments with
MultipoleExpansion.from_moments, or with a dict describing the distribution.
Attributes:
| Name | Type | Description |
|---|---|---|
l_max |
int
|
The maximum multipole moment of the expansion. |
exterior |
bool
|
Whether this is an exterior expansion. |
interior |
bool
|
Whether this is an interior expansion. |
center |
ndarray
|
The expansion center. |
center_of_charge |
ndarray | None
|
The center of charge, weighted by the absolute
values of the charges. |
total_charge |
float | None
|
The total charge. |
prefactor |
float
|
The constant the potential and its derivatives are multiplied with. |
validity_radius |
float
|
The exterior expansion converges outside, the interior expansion inside the sphere of this radius about the expansion center. |
multipole_moments |
dict
|
The multipole moments q_lm (exterior) or I_lm (interior), with keys (l, m), in Racah normalization (see the theory section of the documentation). |
dipole_moment
property
The dipole moment vector p = Σ q (r - center), about the expansion center.
quadrupole_moment
property
The traceless quadrupole moment tensor, about the expansion center.
Q_ij = Σ q (3 x_i x_j - r^2 δ_ij), with x = r - center, so that the potential is Φ = q / r + p·x / r^3 + Σ_ij Q_ij x_i x_j / (2 r^5) + ...
multipole_moments_array
property
The multipole moments q_lm as array of shape (l_max + 1, 2 l_max + 1).
Index it as [l, m], with negative m wrapping around as usual in Python.
Entries with |m| > l are zero.
grid_axes
property
The 1D axes (x, y, z) of the grid, for expansions created from a density.
external_coords
property
The 3D coordinate arrays (X, Y, Z) of the grid, for expansions created from a density.
rho
property
The charge density, for expansions created from a density.
__init__(charge_dist, l_max, exterior=None, interior=None, center=None, charge_tol=1e-06, *, prefactor=1.0, tol=None, radius=None)
Create a MultipoleExpansion object for a given charge or mass distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
charge_dist
|
dict
|
Description of the charge distribution. For discrete charge distributions (point charges) the dict must contain exactly the following items:
For continuous charge distributions (charge density) the dict must contain exactly the following items:
|
required |
l_max
|
int | str
|
The maximum multipole moment to consider
(0 = monopole, 1 = dipole, etc.), or |
required |
exterior
|
bool
|
Whether to perform an exterior expansion (default).
If |
None
|
interior
|
bool
|
Whether to perform an interior expansion. Alternative to
|
None
|
center
|
array_like
|
The point (x, y, z) about which to expand. Defaults to the center of charge, weighted by the absolute values of the charges. |
None
|
charge_tol
|
float
|
Fraction of the total absolute charge of a continuous
distribution that may be ignored when determining the region where
the expansion is valid (see |
1e-06
|
prefactor
|
float | str
|
The constant the potential, field and Hessian are
multiplied with. |
1.0
|
tol
|
float
|
Only for |
None
|
radius
|
float
|
Only for |
None
|
The exterior expansion converges only outside the smallest sphere about the
center that contains all charge, the interior expansion only inside the largest
sphere about the center that contains no charge. The radius of this sphere is
stored in validity_radius. Evaluating the expansion at points where it does
not converge emits an ExpansionValidityWarning. To turn these warnings into
errors, use warnings.simplefilter("error", ExpansionValidityWarning).
Raises:
| Type | Description |
|---|---|
InvalidChargeDistributionException
|
If |
InvalidExpansionException
|
If |
ValueError
|
If |
Examples:
A discrete charge distribution: two point charges with positive and negative unit charge located on the z-axis:
>>> from multipoles import MultipoleExpansion
>>> charge_dist = {
... 'discrete': True,
... 'charges': [
... {'q': 1, 'xyz': (0, 0, 1)},
... {'q': -1, 'xyz': (0, 0, -1)},
... ],
... }
>>> Phi = MultipoleExpansion(charge_dist, l_max=2)
A continuous charge distribution: the same charges, smeared out as gaussians on a cubic grid of edge length 16 centered at the origin:
>>> import numpy as np
>>> x, y, z = [np.linspace(-8, 8, 81)] * 3
>>> XYZ = np.meshgrid(x, y, z, indexing='ij')
>>> def gaussian(XYZ, xyz0, sigma):
... g = np.ones_like(XYZ[0])
... for k in range(3):
... g *= np.exp(-(XYZ[k] - xyz0[k])**2 / sigma**2)
... return g * (sigma**2 * np.pi)**-1.5
>>> rho = gaussian(XYZ, (0, 0, 1), 1.5) - gaussian(XYZ, (0, 0, -1), 1.5)
>>> Phi = MultipoleExpansion({'discrete': False, 'rho': rho, 'xyz': XYZ}, l_max=2)
Evaluate the potential at arbitrary points with Phi(x, y, z) or on the
grid points of a continuous distribution with Phi[...], and the field
with Phi.field(x, y, z). The examples of these methods use Phi and
gaussian from here.
from_charges(q, xyz, l_max, *, exterior=None, interior=None, center=None, prefactor=1.0, tol=None, radius=None)
classmethod
Create the multipole expansion of point charges or point masses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float | array_like
|
The charges, an array of shape (N,), or a number for N equal charges. |
required |
xyz
|
array_like
|
The positions of the charges, an array of shape (N, 3). |
required |
l_max
|
int | str
|
The maximum multipole moment, or |
required |
exterior
|
bool
|
Whether to perform an exterior expansion (default). |
None
|
interior
|
bool
|
Whether to perform an interior expansion. |
None
|
center
|
array_like
|
The expansion center. Defaults to the center of charge. |
None
|
prefactor
|
float | str
|
The constant the potential is multiplied with, e.g. |
1.0
|
tol
|
float
|
Only for |
None
|
radius
|
float
|
Only for |
None
|
Returns:
| Type | Description |
|---|---|
MultipoleExpansion
|
The expansion. |
Examples:
>>> q = [1, -1]
>>> xyz = [(0, 0, 1), (0, 0, -1)]
>>> Phi = MultipoleExpansion.from_charges(q, xyz, l_max=4)
>>> value = Phi(0, 0, 10)
from_density(rho, grid, l_max, *, exterior=None, interior=None, center=None, charge_tol=1e-06, prefactor=1.0, tol=None, radius=None)
classmethod
Create the multipole expansion of a charge or mass density on a grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rho
|
array_like
|
The density, a 3D array. |
required |
grid
|
tuple
|
The grid: either the three 1D axes |
required |
l_max
|
int | str
|
The maximum multipole moment, or |
required |
exterior
|
bool
|
Whether to perform an exterior expansion (default). |
None
|
interior
|
bool
|
Whether to perform an interior expansion. |
None
|
center
|
array_like
|
The expansion center. Defaults to the center of charge. |
None
|
charge_tol
|
float
|
Fraction of the absolute charge that may be neglected for
|
1e-06
|
prefactor
|
float | str
|
The constant the potential is multiplied with, e.g. |
1.0
|
tol
|
float
|
Only for |
None
|
radius
|
float
|
Only for |
None
|
Returns:
| Type | Description |
|---|---|
MultipoleExpansion
|
The expansion. |
Examples:
>>> x = y = z = np.linspace(-8, 8, 81)
>>> X, Y, Z = np.meshgrid(x, y, z, indexing='ij', sparse=True)
>>> rho = np.exp(-(X**2 + Y**2 + (Z - 1)**2)) - np.exp(-(X**2 + Y**2 + (Z + 1)**2))
>>> Phi = MultipoleExpansion.from_density(rho, (x, y, z), l_max=4)
from_moments(moments, center=(0, 0, 0), *, exterior=None, interior=None, prefactor=1.0, validity_radius=None, abs_charge=None)
classmethod
Create a multipole expansion from known multipole moments.
Use it for moments from other programs, or to restore an expansion from
multipole_moments or multipole_moments_array. To save and load expansions,
see also save and load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moments
|
dict | array_like
|
The moments q_lm (exterior) or I_lm (interior) in
Racah normalization, as dict with keys (l, m), or as complex array of shape
(l_max + 1, 2 l_max + 1) indexed by |
required |
center
|
array_like
|
The expansion center. |
(0, 0, 0)
|
exterior
|
bool
|
Whether to perform an exterior expansion (default). |
None
|
interior
|
bool
|
Whether to perform an interior expansion. |
None
|
prefactor
|
float | str
|
As for the constructor. |
1.0
|
validity_radius
|
float
|
The radius of the sphere about the center outside (exterior) or inside (interior) of which the expansion converges. Defaults to 0 (exterior) or infinity (interior), i.e. no validity checks. |
None
|
abs_charge
|
float
|
The total absolute charge. Together with
|
None
|
Returns:
| Type | Description |
|---|---|
MultipoleExpansion
|
The expansion. It has no charges, so the operations that need |
MultipoleExpansion
|
them (e.g. evaluating on a grid) are not available. |
Examples:
>>> moments = {(0, 0): 1, (1, 0): 2} # a charge and a dipole along z
>>> Phi = MultipoleExpansion.from_moments(moments)
>>> value = Phi(0, 0, 10) # 1/10 + 2/100
__call__(*xyz, l_max=None)
Evaluate the multipole expansion at points with given coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*xyz
|
float | array_like
|
The points where to evaluate the expansion: either their coordinates x, y, z as three numbers or arrays, or one array of shape (..., 3) of points. If three numbers are given, the expansion is evaluated at the single point (x, y, z). If arrays are given, it is evaluated at each point (x[i], y[i], z[i]). Arrays may have any shape; numbers and arrays are broadcast against each other. |
()
|
l_max
|
int
|
Only use contributions up to this angular momentum.
Defaults to the |
None
|
Returns:
| Type | Description |
|---|---|
float | ndarray
|
The value of the potential: a float for a single point, otherwise an array of the broadcast shape of the coordinates (or the shape of the array of points without its last axis). |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If some of the points lie where the expansion does not converge. |
Examples:
>>> value = Phi(30.5, 30.6, 30.7)
>>> value = Phi(30.5, 30.6, 30.7, l_max=1) # monopole and dipole only
>>> values = Phi(np.linspace(10, 20, 5), 0, 0) # 5 points on the x-axis
>>> values = Phi(np.array([[10, 0, 0], [0, 0, 10]])) # 2 points
evaluate(*xyz, field=True, hessian=False, l_max=None)
Evaluate the potential and, at little extra cost, its derivatives at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*xyz
|
float | array_like
|
The points, as for |
()
|
field
|
bool
|
Whether to compute the field, as with |
True
|
hessian
|
bool
|
Whether to compute the Hessian, as with |
False
|
l_max
|
int
|
Only use contributions up to this angular momentum. |
None
|
Returns:
| Type | Description |
|---|---|
Evaluation
|
A named tuple |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If some of the points lie where the expansion does not converge. |
Examples:
>>> potential, E, _ = Phi.evaluate(30.5, 30.6, 30.7)
>>> result = Phi.evaluate(30.5, 30.6, 30.7, hessian=True)
>>> H = result.hessian
field(*xyz, l_max=None)
Evaluate the field E = -∇Φ of the multipole expansion.
The derivatives are computed analytically from the multipole moments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*xyz
|
float | array_like
|
The points, as for |
()
|
l_max
|
int
|
Only use contributions up to this angular momentum,
as for |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The field components (E_x, E_y, E_z). If the points are given as coordinates x, y, z, the components are stacked along the first axis: shape (3,) for a single point, otherwise (3, *shape) where shape is the broadcast shape of the coordinates. If the points are given as one array of shape (..., 3), the result has the same shape. |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If some of the points lie where the expansion does not converge. |
Examples:
>>> Ex, Ey, Ez = Phi.field(30.5, 30.6, 30.7)
>>> E = Phi.field(np.linspace(10, 20, 5), 0, 0) # shape (3, 5)
>>> E = Phi.field(np.array([[10, 0, 0], [0, 0, 10]])) # shape (2, 3)
hessian(*xyz, l_max=None)
Evaluate the Hessian ∂²Φ/∂x_i∂x_j of the multipole expansion.
The derivatives are computed analytically from the multipole moments. The negative Hessian is the gradient of the field (e.g. the electric field gradient, or the tidal tensor in gravity).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*xyz
|
float | array_like
|
The points, as for |
()
|
l_max
|
int
|
Only use contributions up to this angular momentum,
as for |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The symmetric 3x3 matrix of the second derivatives at each point. If the points are given as coordinates x, y, z, the shape is (3, 3, *shape), otherwise (..., 3, 3). |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If some of the points lie where the expansion does not converge. |
Examples:
>>> H = Phi.hessian(30.5, 30.6, 30.7) # shape (3, 3)
contributions(*xyz, l_max=None)
The contributions of each order l to the potential.
Useful to see how fast the expansion converges. Their sum is the potential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*xyz
|
float | array_like
|
The points, as for |
()
|
l_max
|
int
|
Only return the contributions up to this angular momentum. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The contributions Φ_l for l = 0, ..., l_max along the first axis, i.e. of shape (l_max + 1, *shape). |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If some of the points lie where the expansion does not converge. |
Examples:
>>> phi_l = Phi.contributions(0, 0, 30) # monopole, dipole, quadrupole
>>> bool(np.isclose(phi_l.sum(), Phi(0, 0, 30)))
True
__getitem__(key)
Evaluate the multipole expansion on grid points of the charge distribution.
Only available for continuous charge distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
index expression | array_like
|
Slices, indices or a boolean mask selecting the points of the grid at which to evaluate the expansion. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The values of the multipole expansion, in the shape defined
by |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the expansion was not created from a charge density. |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If some of the points lie where the expansion does not converge. |
Examples:
>>> x, y, z = [np.linspace(-8, 8, 81)] * 3
>>> X, Y, Z = np.meshgrid(x, y, z, indexing='ij')
>>> rho = gaussian((X, Y, Z), (0, 0, 0), 1.5)
>>> mpe = MultipoleExpansion({'discrete': False, 'rho': rho, 'xyz': (X, Y, Z)}, l_max=3)
Evaluate on the plane z = -8 (an 81x81 array):
>>> plane = mpe[:, :, 0]
Evaluate only on the boundary of the grid, using a boolean mask:
>>> mask = np.ones_like(rho, dtype=bool)
>>> mask[1:-1, 1:-1, 1:-1] = False
>>> boundary_values = np.zeros_like(rho)
>>> boundary_values[mask] = mpe[mask]
field_on_grid(key=Ellipsis, l_max=None)
Evaluate the field on grid points of the charge density, like Phi[key] for the potential.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
index expression | array_like
|
Slices, indices or a boolean mask selecting the points of the grid. Defaults to the whole grid. |
Ellipsis
|
l_max
|
int
|
Only use contributions up to this angular momentum. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The field components stacked along the first axis, of shape
(3, *shape) where shape is the shape defined by |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the expansion was not created from a charge density. |
Examples:
>>> E = Phi.field_on_grid(np.s_[0, :, :]) # on the plane x = -8, shape (3, 81, 81)
boundary_values(width=1, l_max=None)
The potential on the boundary of the grid, e.g. as boundary condition for a Poisson solver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
int
|
The number of layers of grid points at the boundary to fill. |
1
|
l_max
|
int
|
Only use contributions up to this angular momentum. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
An array of the shape of the grid, with the potential on the
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If the expansion was not created from a charge density. |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If the boundary of the grid is too close to the charge. |
Examples:
>>> bc = Phi.boundary_values() # shape (81, 81, 81)
is_valid(*xyz)
Check where the multipole expansion converges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*xyz
|
float | array_like
|
The points, as for |
()
|
Returns:
| Type | Description |
|---|---|
bool | ndarray
|
Whether the expansion converges at each point, i.e.
whether the point lies outside (exterior expansion) or inside (interior
expansion) the sphere of radius |
Examples:
>>> X, Y, Z = Phi.external_coords
>>> valid = Phi.is_valid(X, Y, Z) # boolean mask of the grid
>>> values = np.full(valid.shape, np.nan)
>>> values[valid] = Phi[valid]
error_bound(*xyz, l_max=None)
An upper bound of the truncation error of the potential.
For each charge q at distance s from the center, the error of the exterior
expansion at distance r from the center is at most |q| (s/r)^(l_max+1) / (r - s);
for the interior expansion, swap r and s. The bound is the sum over all charges,
which are binned radially for speed. For continuous distributions, it ignores the
fraction charge_tol of the charge that lies beyond validity_radius, as well
as the integration error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*xyz
|
float | array_like
|
The points, as for |
()
|
l_max
|
int
|
The order of the truncated expansion. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
float | ndarray
|
The bound at each point, infinite where the expansion does not converge. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the expansion was created from moments without |
Examples:
>>> bound = Phi.error_bound(30, 0, 0)
cartesian_moment(l)
The cartesian multipole moment of order l, a symmetric traceless tensor of rank l.
For the exterior expansion, it is the tensor M with Φ_l = M_{i1...il} x_i1 ... x_il / (l! r^(2l+1)), i.e. M = (2l-1)!! Σ q (x^l with traces removed): the total charge for l=0, the dipole moment for l=1, the quadrupole moment for l=2, the octupole moment for l=3 etc., all about the expansion center. For the interior expansion, it is the tensor of the l-th derivatives of the potential at the center.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l
|
int
|
The order, at most |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The tensor, of shape (3,) * l. |
Examples:
>>> quadrupole = Phi.cartesian_moment(2) # shape (3, 3), same as Phi.quadrupole_moment
moments(normalization='racah', real=False)
The multipole moments in other conventions, as array indexed by [l, m].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
normalization
|
str
|
|
'racah'
|
real
|
bool
|
Return the real moments for the real spherical harmonics instead:
|
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The moments, of shape (l_max + 1, 2 l_max + 1), complex unless
|
power_spectrum()
The strength of each order l, sqrt(Σ_m |q_lm|²), for l = 0, ..., l_max.
Unlike the moments themselves, it does not change when the distribution is rotated about the expansion center.
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of shape (l_max + 1,). |
shifted(center)
The same expansion about another center.
If the expansion knows its charges, the moments are recomputed about the new center.
Otherwise, they are translated with the addition theorem of the solid harmonics: for
exterior expansions, this gives the exact moments up to l_max about the new center,
and the validity radius grows by the distance between the centers. For interior
expansions, the result is the same truncated polynomial, so it has the same
truncation error, and the validity radius shrinks by the distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center
|
array_like
|
The new expansion center. |
required |
Returns:
| Type | Description |
|---|---|
MultipoleExpansion
|
The new expansion. |
Examples:
>>> shifted = Phi.shifted((0, 0, 1))
__add__(other)
The expansion of the combined charge distribution of two expansions.
Both must be of the same kind (exterior or interior) and have the same prefactor. The
result has the smaller of both l_max. If both know their charges, it is computed
from all charges, about the center of charge of both, unless an expansion center
was given explicitly for the left operand. Otherwise, the moments of the right
operand are translated to the center of the left one and added.
__mul__(factor)
The expansion of the charge distribution multiplied by a number.
energy(q, xyz)
The potential energy Σ q_i Φ(x_i) of point charges in the potential of the expansion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
float | array_like
|
The charges, an array of shape (N,) or a number. |
required |
xyz
|
array_like
|
Their positions, an array of shape (N, 3). |
required |
Returns:
| Type | Description |
|---|---|
float
|
The energy, including the |
Warns:
| Type | Description |
|---|---|
ExpansionValidityWarning
|
If some of the charges lie where the expansion does not converge. |
Examples:
>>> W = Phi.energy([1, -1], [(30, 0, 1), (30, 0, -1)])
to_dict()
The expansion as dict of numbers and arrays, e.g. for storing it in a file.
It contains the moments, the center, the kind of expansion, the prefactor and what is
needed for the validity checks and the error bound, but not the charges. Restore the
expansion with MultipoleExpansion.from_dict.
Returns:
| Type | Description |
|---|---|
dict
|
The data of the expansion. |
from_dict(data)
classmethod
Restore an expansion from the dict returned by to_dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
The dict, e.g. as stored with |
required |
Returns:
| Type | Description |
|---|---|
MultipoleExpansion
|
The expansion, without charges, as from |
save(file)
Save the expansion to a NumPy .npz file. Load it with MultipoleExpansion.load.
The charges are not saved, only what is needed to evaluate the expansion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
str | path | file
|
Where to save the expansion. |
required |
load(file)
classmethod
Load an expansion saved with save.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
str | path | file
|
The |
required |
Returns:
| Type | Description |
|---|---|
MultipoleExpansion
|
The expansion, without charges, as from |
plot_slice(normal='z', offset=None, extent=None, resolution=200, field=False, ax=None, l_max=None, **kwargs)
Plot the potential on a plane through the expansion. Needs matplotlib.
Points where the expansion does not converge are left blank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
normal
|
str
|
The axis normal to the plane, |
'z'
|
offset
|
float
|
The position of the plane along |
None
|
extent
|
float
|
Half the edge length of the plotted square about the center. Defaults to 4 times (exterior) or 1 times (interior) the validity radius. |
None
|
resolution
|
int
|
The number of points along each side. |
200
|
field
|
bool
|
Whether to draw field lines on top. |
False
|
ax
|
Axes
|
Where to plot. Defaults to the current axes. |
None
|
l_max
|
int
|
Only use contributions up to this angular momentum. |
None
|
**kwargs
|
Any
|
Passed on to |
{}
|
Returns:
| Type | Description |
|---|---|
Axes
|
The axes. |
multipoles.Evaluation
Bases: NamedTuple
The result of MultipoleExpansion.evaluate. Quantities that were not requested are None.
multipoles.ExpansionValidityWarning
Bases: UserWarning
Emitted when the expansion is evaluated at points where it does not converge.
multipoles.InvalidChargeDistributionException
Bases: Exception
Raised when the charge distribution is malformed or cannot be expanded, e.g. because keys are missing, its total absolute charge is zero, or the grid is invalid.
multipoles.InvalidExpansionException
Bases: Exception
Raised when the requested expansion is contradictory or impossible, e.g. an interior expansion with charge at the expansion center.