In electrodynamics (or gravitational theory) the electric field
Where
The potential
- The Cartesian multipole expansion
- The spherical (harmonic) multipole expansion
The symmetric and traceless tensors
The purpose of this command-line tool is to convert between these two kind of
multipole moments. For example, if you have computed the Cartesian multipole
moments for your application, but now you need the spherical multipole moments,
then this command-line tool computes formulae in which you can plug in your
Cartesian multipole moments to get the
The multipole-conv
tool needs an additional library to be compiled, namely the
boost
library. This library is contained in the repositories of most Linux
distributions. In case, you have not installed it yet, you can install it with
the following commands:
Ubuntu/Debian
sudo apt-get install libboost-all-dev
Arch Linux/Manjaro
sudo pacman -Syu boost
In a next step, clone the repository and call CMake and make, i.e.
git clone https://github.com/nils-schween/multipole-conv.git
cd multipole-conv
cmake -S . -B build
cd build
make
Now there should be a build
directory, which contains the multipole-conv
binary.
multipole-conv
is a command-line tool. The call ./multipole-conv -h
provides
you with an overview of all possible options, i.e.
Options:
-h [ --help ] Help screen
-v [ --version ] Displays the version number.
-d [ --degree ] arg Degree of spherical or Cartesian multipole
moments.
-c [ --convention ] arg Conventions are predefined set of options.
Possible values are solid_harmonics, jackson,
johnston, real_solid_harmonics.
--complex arg Use complex solid harmonics.
--complex-conjugate arg Use the complex conjugate of the solid harmonics.
--normalisation arg Normalise the (real or complex) solid harmonics.
--remove-csp arg Remove the Condon-Shortley phase.
--include-addition-thm arg Include the addition theorem factor in the
definition of the spherical multipole moments.
--split-addition-thm arg Include the square root of the addition theorem
factor in the definition of the spherical
multipole moments. (Requires that the option
"inlcude-addition-thm" is set.)
--cartesian arg Compute the Cartesian multipole moments.
--dependent-components arg Compute the dependent components of the Cartesian
multipole moments.
--include-l-factorial arg Include l! from the Taylor expansion in the
definition of the Cartesian multipole moment
To get started, the most important options are --degree, -d
, --convention,c
and --cartesian
.
The -d
option expects an integer as argument and corresponds to the order of
the two multipole expansions. For example, if multipole-conv
is called with
the option -d 2
, then it will provide you with the formulae which relate the
quadrupole moment
The -c
option expects a string as argument. All possible values are listed in
the help text. This option is meant to ease the handling of the available
options. Every "convention" represents a predefined collection of options. For
example, the convention jackson
represents a combination of options such that
the definition of the (Cartesian) multipole moments and of the spherical
multipole moments are in agreement with the definitions in Jackson's textbook
"Classical Electrodynamics".
The --cartesian
option expects either 0 or 1. If it is one, then the
(Cartesian) multipole moments are given as a sum over the spherical multipole
moments. And if it is 0 (which is the default), the multipole-conv
tool
provides the user with expressions of the spherical multipole moments in terms
of the (Cartesian) multipole moments.
The other options are explained in detail in the section Options.
An example call of multipole-conv
would be
./multipole-conv -d 2 -c jackson
The output of the above command is
Spherical multipole moments
q^+2 _2 = -0.257516-0i Q_0,2,0 -0.128758-0i Q_0,0,2 +0-0.257516i Q_1,1,0
q^+1 _2 = +0+0.257516i Q_0,1,1 -0.257516-0i Q_1,0,1
q^+0 _2 = +0.315392-0i Q_0,0,2
q^-1 _2 = +0+0.257516i Q_0,1,1 +0.257516-0i Q_1,0,1
q^-2 _2 = -0.257516-0i Q_0,2,0 -0.128758-0i Q_0,0,2 +0+0.257516i Q_1,1,0
On the left-hand side the spherical multipole moments
Note that the
Hence, it is always possible to sort the indices such that the component becomes
Another important point to note is that on the right-hand side of the output
there are no components of the (Cartesian) multipole moment with
and it results in a set of equations which allows to express all the components
of the tensors
This becomes clear when an example is considered: In Jackson's textbook
"Classical Mechanics" you find the following equation for
Note that the component
and plugging this into Jackson's expression for multipole-conv
tool.
Up to now, we looked at the output of the multipole-conv
tool for the
spherical multipole moments. Its output for the (Cartesian) multipole moments is
obtained with the call
./multipole-conv -d 2 -c jackson --cartesian 1
and it is
Cartesian multipole moments (independent components = multipole basis functions)
Q_0,2,0 = -1.94163-0i q^+2_2 -1.58533-0i q^+0_2 -1.94163-0i q^-2_2
Q_0,1,1 = +0-1.94163i q^+1_2 +0-1.94163i q^-1_2
Q_0,0,2 = +3.17066-0i q^+0_2
Q_1,0,1 = -1.94163-0i q^+1_2 +1.94163-0i q^-1_2
Q_1,1,0 = +0+1.94163i q^+2_2 +0-1.94163i q^-2_2
Cartesian multipole moments (dependent components)
Q_2,0,0 = +1.94163+0i q^+2_2 -1.58533+0i q^+0_2 +1.94163+0i q^-2_2
We see the components of the quadrupole moment expressed in terms of the
spherical multipole moments of degree two. For the components of the quadrupole
moment the
Note: Currently, the multipole-conv
command-line tool works without
problems up to degree 15. Afterwards numerical problems appear and its results
must be looked upon with care. In case, you need more precision, just file an
issue and we will try to make it work.
The multipole-conv
command-line tool provides options to deal with the
different forms of the multipole expansions used in different areas of physics.
The available options can be split into two parts: options changing the
spherical multipole expansion and options changing the (Cartesian) multipole
expansion.
The options for the spherical multipole expansion concern the spherical harmonic functions, which are part of the definition of the spherical multipole moments.
--complex and --complex-conjugate
If complex spherical harmonics are used the spherical multipole expansion is
and the spherical multipole moments are defined as
Instead of using complex spherical harmonics
and the definition of the real spherical multipole moments is
If complex spherical harmonics are used in the multipole expansion, then the
spherical multipole moment's definition contains complex-conjugate spherical
harmonics and it is necessary to add the option --complex 1
and
--complex-conjugate 1
. If these options are not set, real spherical harmonics
are used, because they are contained in definition of the real spherical
multipole moments
--normalisation
Real and complex spherical harmonics can be normalised or not. It they are
normalised, as in the case of the definitions of --normalisation 1
must be included in the call of the
multipole-conv
tool.
We denote the complex spherical harmonics without normalisation with
and, accordingly,
The real spherical harmonics without normalisation are denoted with
The default value of the option --normalisation
is 0
. Moreover, when
./multipole-conv
is called with only --degree
(or, alternatively -d
), then
the above multipole expansion with its definition of
--include-addition-theorem
In all four versions of the spherical multipole expansion there is an additional
numerical factor (e.g. $4\pi/(2l + 1)$) right after the summation symbols. This
factor is a consequence of the addition theorem for spherical
harmonics.
Some authors include it in their definition of the spherical multipole moments.
If this is the case, then multipole-conv
should be called with
--include-addition-theorem 1
. Its default value is 0
.
--split-addition-theorem
This addition theorem factor is sometimes split, namely
and its square root is then included in the definition of the spherical
multipole moment. If this is the case, multipole-conv
should be called with
--include-addition-theorem 1 --split-addition-theorem 1
. Its default value is
0
.
--remove_condon_shortley_phase
Very often the definition of the associated Legendre Polynomials contains a
factor
If this factor is not included in the associated Legendre Polynomials nor
in the spherical harmonics, it is not included in the definition of the
spherical multipole moments and needs to be removed. In this case
multipole-conv
should be called with --remove_condon_shortley_phase 1
.
--cartesian
If set to 1
, multipole-conv
computes the (Cartesian) multipole moments in
terms of the spherical multipole moments as described at the end of the
Usage section. Its default value is 0
.
--dependent_components
As explained in the section Interpreting the Output,
we distinguish between independent components and dependent components of the
(Cartesian) multipole moments. If multipole-conv
is called with
--dependent_componets 1
, then it also outputs formulae for the dependent
components. Its default value is 0
.
--include_l_factorial
The (Cartesian) multipole expansion is
The factor multipole-conv
should be called with
--include_l_factorial 1
. Its default value is 0
.
The dynamics of a plasma are modelled with the Boltzmann equation. In some cases
it can be useful to expand the distribution function
as done by Johnston in his 1960 paper "Cartesian Tensor Scalar Product and Spherical Harmonic Expansions in Boltzmann's Equation". Note that Johnston does not include the Condon-Shortley phase in the definition of the associated Legendre Polynomials nor in the definition of the real spherical harmonics (without normalisation) and, hence, we included it in the first equation to be consistent with our notation. In his paper he uses
To express the components of the Cartesian tensors johnston
. For example, the call
./multipole-conv -d 2 -c johnston
produces
Cartesian multipole moments (independent components = multipole basis functions)
Q_0,2,0 = -3 q_2,2,0 -0.5 q_2,0,0
Q_0,1,1 = 1.5 q_2,1,1
Q_0,0,2 = 1 q_2,0,0
Q_1,0,1 = 1.5 q_2,1,0
Q_1,1,0 = 3 q_2,2,1
Cartesian multipole moments (dependent components)
Q_2,0,0 = 3 q_2,2,0 -0.5 q_2,0,0
It is, of course, possible to work with complex and normalised spherical
harmonics instead of using
The space of homogeneous and harmonic polynomials of degree
Another basis of this space are the multipole basis functions
The multipole-conv
tool can compute the basis transformation between these two
bases. If you call it with the convention solid_harmonics
( or
real_solid_harmonics
) it outputs expressions for the solid harmonics (real
solid harmonics) in terms of the multipole basis functions.
Maybe, you need to convert very often between spherical multipole moments and
(Cartesian) multipole moments (or vice versa) and you want do this in your
program. In this case, you can use the multipole-conv
as a library; just
include the necessary headers in your code. If you have difficulties setting
this up, contact us.
In case, your are programming in Python, but you still want to use the
multipole-conv
in your program, then you can use the Python code in the
multipole-conv.py
file in the python
folder of this repository. This file is
completely independent of the C++ code. It contains almost all the options,
which are provided in the C++ code (currently it cannot compute dependent
components of the Cartesian multipole moments). The functions which it contains
are explained in our paper (see section Cite our paper).
If you are using multipole-conv
in your work, please include a reference to
our paper
@article{Schween_Converting_between_the_2022,
author = {Schween, Nils W. and Reville, Brian},
doi = {10.1017/S002237782200099X},
journal = {Journal of Plasma Physics},
month = {10},
number = {5},
pages = {905880510},
title = {{Converting between the Cartesian tensor and spherical harmonic expansion of solutions to the Boltzmann equation}},
volume = {88},
year = {2022}
}