# Laser Cooling of Trapped Ions in Strongly Inhomogeneous Magnetic Fields

Richard Karl, Yanning Yin and Stefan Willitsch CONTACT S. Willitsch. Email:
<EMAIL_ADDRESS>Department of Chemistry, University of Basel,
Klingelbergstrasse 80, 4056 Basel, Switzerland

###### Abstract

Hybrid traps for the simultaneous confinement of neutrals and ions have
recently emerged as versatile tools for studying interactions between these
species at very low temperatures. Such traps rely on the combination of
different types of external fields for the confinement of either species
raising the question of interactions between the individual traps. Here, the
influence of a strongly inhomogeneous magnetic field used for trapping
neutrals on the trapping and laser cooling of a single Ca+ ion in a
radiofrequency ion trap is studied theoretically using molecular-dynamics
simulations based on multilevel rate equations. The inhomogeneous magnetic
field couples the different components of the ion motion and introduces
position-dependent Zeeman splittings. Nonetheless, laser cooling is still
found to work efficiently as the ion samples different magnetic field
strengths and directions along its trajectory. Offsetting the centres of the
two traps generates a linear magnetic-field gradient so that multiple lasers
are required to address the resulting range of Zeeman splittings in order to
ensure efficient cooling. The present study yields detailed insights into the
ion cooling dynamics in combined magnetic and radiofrequency electric fields
relevant for the characterisation and optimisation of hybrid trapping
experiments.

###### keywords:

radiofreqeuncy ion traps; magnetic traps; hybrid traps; multilevel rate
equations; molecular-dynamics simulations

##  1 Introduction

Magnetic ($B$-) fields are widely used tools for the manipulation of the
external as well as the internal degrees of freedom of ions. For instance, in
Penning traps homogeneous $B$-fields with strengths 1-10 T introduce Lorentz
forces that confine charged particles perpendicularly to the $B$-field while
static electric fields trap them along the $B$-field direction [1]. At the
same time, the $B$-field defines the quantisation axis of the internal energy
levels of the ions by lifting degeneracies via the Zeeman effect. In contrast
to the strong magnetic fields in Penning traps, radio-frequency (RF) traps
confine ions only using electric fields, and the quantisation axis is
typically defined by an additional weak homogeneous $B$-field of strength 1-10
G. The difference in the field strengths requires different laser-cooling
strategies for the two types of traps. The Zeeman splittings caused by fields
of a few Gauss are often smaller than the laser linewidths used in Doppler
cooling such that a single laser beam can, in principle, drive all Zeeman
sublevels of an optical cycling transition of an ion in a RF trap. In Penning
traps, the Zeeman splittings are significantly larger than the laser
linewidths and more elaborate schemes involving additional lasers are
necessary [2] to address all relevant states. Moreover, RF traps are typically
designed such that the ion motion is harmonic and all motional modes can be
efficiently cooled by a single laser beam at an angle to the three principal
axes of the trap [3]. The strong magnetic field in a Penning trap also causes
a cyclotron and a magnetron motion. Additional procedures like offsetting the
laser beams from the trap centre [4] or applying an oscillating field to
couple the cyclotron and the magnetron motion [5] are required to cool all
motional modes in a Penning trap.
Moreover, magnetic fields are sometimes intentionally added to engineer the
level structure of particles. For instance, when working with molecules or
exotic matter an adequately chosen homogeneous $B$-field can mix dark states
and thereby improve the laser cooling efficiency [6, 7, 8].
Advanced laser cooling schemes involving $B$-field gradients have been studied
theoretically for improved cooling efficiency in the Lamb-Dicke regime [9] and
for cooling of molecular anions via a magnetically-assisted Sisyphus process
[10]. $B$-field gradients are also widely used in trapped-ion quantum-science
experiments. Both static [11, 12, 13, 14] and oscillating [15, 16, 17, 18, 19,
20] field gradients have been used to realise laser-free entangling gates and
individual ion addressing. In those experiments, relatively small gradients of
about 0.25-25 T/m were used and no significant effect on the laser cooling
efficiency was reported.
A higher degree of inhomogeneity is present in quadrupolar magnetic fields
which form the basis of magnetic and magneto-optical traps. There are numerous
theoretical and experimental studies of neutral atoms and molecules in
quadrupolar magnetic traps [21, 22, 23] and in magneto-optical traps [24, 25,
26, 27]. Such traps, however, are usually not used for ions since ion traps
already provide deep and stable trapping. Nevertheless, understanding the
motion of ions in quadrupolar magnetic fields and how their light-matter
interaction is affected by the $B$-field becomes relevant with the development
of hybrid traps. In hybrid traps, neutral species and ions are trapped
simultaneously which allows the study of cold and ultracold ion-neutral
collisions with long interaction times [28, 29]. Hybrid traps have been
realised by overlapping RF ion traps with magnetic [30], optical [31, 32, 33]
or magneto-optical traps [34, 35, 36, 37] for neutrals.
The success of these experiments with neutral atoms inspires similar studies
with trapped neutral molecules to be combined with ions. However, magnetic
traps for molecules usually exhibit much stronger inhomogeneous fields than
those used for atoms [38], raising the question of the influence of the strong
$B$-fields on the ion motion and laser-cooling dynamics. In this manuscript,
we report molecular-dynamics simulations to explore laser cooling of an ion in
a strong quadrupolar magnetic field. The insights gained in the present study
provide a more detailed understanding of hybrid trapping experiments and may
serve towards their optimisation and extension to molecular species.

Figure 1: (a) Energy level structure relevant for the Doppler laser cooling of
40Ca+. The field-free fine-structure levels are indicated by dotted lines with
transition wavelengths $\lambda_{t}$ and decay rate constants $\Gamma_{t}$
($t=$c/r for cooling/repumper) according to reference [39]. In a $B$-field,
these levels split into an eight-level system. Throughout this manuscript, the
Zeeman sublevels are numbered from 1 to 8 as indicated in the figure. (b,c)
Frequencies of $\sigma$\- and $\pi$-transitions between Zeeman components
(indicated by their magnetic quantum numbers $m_{J}$) of the cooling (b) and
repumper (c) transitions as a function of the axial ($z$) position of the ion
in the hybrid trap.

##  2 Theoretical models

###  2.1  Model for Doppler laser cooling

In Doppler laser cooling, photon scattering from a red-detuned laser beam
generates a directional force that cools the motion of a counter-propagating
atom [40]. The scattering rate, and thus the cooling force, depends on the
internal properties of the atom via the spontaneous decay rates on selected
spectroscopic transitions and on the external dynamics via the Doppler and
Zeeman shifts and position-dependent laser parameters. In a hybrid trap
composed of a RF trap and a magnetic trap, micromotion and magnetic field
gradients can lead to timescales of the external dynamics that are comparable
to the timescales of the internal population dynamics. Therefore, it is not
valid to assume steady-state level populations of the ion as it is often done
in laser cooling models based on a continuous friction force [41, 42, 43].
Instead, a stochastic model is more appropriately used for the light-matter
interaction in which discrete transitions and discrete time steps are assumed
[44, 45]. Such a model assumes that the ion is in one specific quantum state
at a time which can be thus tracked over the course of the simulation. At each
time step, the probability for an absorption or an emission event is computed.
By comparing the absorption and emission probabilities to a random number
between zero and one, it is decided whether an absorption or emission event
takes place within a given time step $\delta t$. In such a case, the state of
the ion is updated and the ion experiences a recoil either parallel or anti-
parallel to the laser propagation direction, or in a random direction
depending on whether absorption, stimulated emission or spontaneous emission
occurred. For a particular state, the probability for emission is given by the
sum of the spontaneous-decay and the stimulated-emission probabilities. The
spontaneous decay probability is given by $\Gamma\delta t$ with $\Gamma$ being
the natural linewidth of the relevant transition. In the present stochastic
model, the stimulated decay probability is assumed to be equal to the
probability for absorption which we express as $R\delta t$ (see also section
2.2). Here, $R$ is the excitation rate. By choosing $\delta t\ll 1/R$ and
$\delta t\ll 1/\Gamma$ it is ensured that the absorption and emission
probabilities are smaller than 1 at each time step [44].
Besides Doppler cooling, a stochastic model naturally captures processes that
are either neglected or require further elaboration in continuous force
models. These include heating due to photon recoil, fluctuations of the
absorption rate, stimulated emission and saturation effects [44].

###  2.2 Rate equations for state-population dynamics

To implement the stochastic model for laser cooling, an expression for the
excitation rate $R$ is needed. We use multilevel rate equations [26, 46, 47]
to describe the internal dynamics of a trapped ion from which we derive an
expression for $R$. The validity of the current rate-equation treatment was
verified against optical Bloch equations as discussed in section A in the
appendix. In experiments using alkaline-earth ions such as Ca+ [48], Doppler
laser cooling is implemented using a 2S${}_{1/2}-^{2}$P1/2 cooling transition
and a 2D${}_{3/2}-^{2}$P1/2 repumper transition, see figure 1.
We distinguish between the cooling and the repumper transition via the index
$t=\\{\text{c},\text{r}\\}$ and denote the decay rate constants as
$\Gamma_{t}$. In a magnetic field, this three-level energy structure splits
into an eight-level system (figure 1). Here, the index $j$ indicates Zeeman
sublevels of the (4p) 2P1/2 state, while the Zeeman sublevels of the (4s)
2S1/2 and of the (3d) 2D3/2 states are referred to as $i$. When $i$ is a
Zeeman sublevel of (4s) 2S1/2, $t$ is set to c. Conversely, $t=\text{r}$ when
$i$ is a Zeeman sublevel of (3d) 2D3/2. Within this notation, the dynamics of
the populations $N_{j}$ of the 2P1/2 Zeeman sublevels is given by

$\dot{N_{j}}=-\left(\Gamma_{\text{c}}+\Gamma_{\text{r}}\right)N_{j}+\sum_{i,l_{t}}R_{i,j,l_{t}}(N_{i}-N_{j}),$
(1)

in which $R_{i,j,l_{t}}$ is the excitation rate constant for the transition
$i\leftrightarrow j$ driven by the laser beam $l_{t}$. The evolution of
$N_{i}$ is described by

$\dot{N_{i}}=\sum_{j,l_{t}}R_{i,j,l_{t}}(N_{j}-N_{i})+\sum_{j}r_{i,j}\Gamma_{t}N_{j},$
(2)

in which $r_{i,j}$ is the branching ratio for the spontaneous decay of level
$j$ to level $i$. The excitation rate constants can be expressed as a sum over
laser beams $l_{t}$ that independently drive the transition $t$ [26]:

$R_{i,j,l_{t}}=\sum_{l_{t}}\frac{f_{i,j,l_{t}}\ \Omega_{l_{t}}^{2}\
\tilde{\Gamma}_{l_{t}}}{4\
\left(\delta_{l_{t}}-\vec{k}_{l_{t}}\cdot\vec{v}-\omega^{\text{z}}_{i,j}\right)^{2}+\tilde{\Gamma}_{l_{t}}^{2}}.$
(3)

Here, $\delta_{l_{t}}=\omega_{l_{t}}-\omega_{t}$ is the detuning of a laser
beam with angular frequency $\omega_{l_{t}}$ from the transition angular
frequency $\omega_{t}$, $\vec{k}_{l_{t}}$ is the wave vector of laser beam
$l_{t}$, $\vec{v}$ is the velocity of the ion, and
$\omega_{i,j}^{\text{z}}=(g_{j}m_{j}-g_{i}m_{i})\mu_{\text{B}}B/\hbar$ is the
Zeeman shift. $\mu_{\text{B}}$ is the Bohr magneton, $\hbar$ is the reduced
Planck constant, $B$ is the magnetic field strength, $g_{j}$, $g_{i}$ are the
relevant Landé $g$-factors and $m_{j}$, $m_{i}$ are the magnetic quantum
numbers of the sublevels $j$ and $i$. We define
$\tilde{\Gamma}_{l_{t}}=\left(\Gamma_{\text{c}}+\Gamma_{\text{r}}\right)+L_{l_{t}}$
as the sum of the decay rate constants and the full-width-at-half-maximum
(FWHM) linewidth $L_{l_{t}}$ of laser beam $l_{t}$.
$\Omega_{l_{t}}=\Gamma_{t}\sqrt{S_{l_{t}}/2}$ is the Rabi frequency with which
a laser with saturation parameter $S_{l_{t}}=I_{l_{t}}/I^{\text{sat}}_{t}$
drives the transition $t$ in absence of a $B$-field. The fractional strength
$f_{i,j,l_{t}}$ of the transition $i\leftrightarrow j$ driven by laser beam
$l_{t}$ with polarisation $\vec{\epsilon}_{l_{t}}$ is given by

$f_{i,j,l_{t}}=\frac{|\langle
i|\vec{D}\cdot\vec{\epsilon}_{l_{t}}|j\rangle|^{2}}{\sum_{i}|\langle
i|\vec{D}|j\rangle|^{2}},$ (4)

where $\vec{D}$ is the dipole moment operator. The quantisation axis of the
ion is defined by the local $B$-field (”atomic frame”) in which atomic
properties like the dipole moment operator $\vec{D}$ are typically expressed
[49]. The polarisation vector $\vec{\epsilon}_{l_{t}}$ is defined relative to
the $k$-vector of the laser beam $l_{t}$ and therefore needs to be transformed
into the atomic frame to evaluate equation (4). This transformation needs to
be computed at every time step of the ion trajectory (see section 2.3) as the
$B$-field is inhomogeneous.

Figure 2: The sum of the populations of the two 2P1/2 Zeeman sublevels $N_{3}$
and $N_{4}$ according to our stochastic model (black) based on eight-level
rate-equations. The inset shows the result of the stochastic model for a
single simulation run. The ensemble average over multiple repetitions (here
200 times in the black trace) approaches the continuous solutions of the rate
equations (red trace). Two counter-propagating cooling and two counter-
propagating repumper lasers with saturation parameters
$S_{\text{c},1}=S_{\text{c},2}=S_{\text{r},1}=S_{\text{r},2}=10$, detunings
$\delta_{\text{c},1}=\delta_{\text{c},2}=-30$ MHz,
$\delta_{\text{r},1}=\delta_{\text{r},2}=-10$ MHz and left circular
polarisation with respect to the laser propagation direction at a $B$-field of
100 G were assumed.

Since in our stochastic model an ion can only be in one state at a time (see
section 3.2), $N_{i}$ and $N_{j}$ are either 0 or 1. Depending on the state of
the ion, the excitation rate $R$ is therefore either zero or given by the
excitation rate constant $R_{i,j,l_{t}}$ expressed in equation (3). According
to the stochastic nature of the model, a single quantum jump only occurs very
rarely and seemingly randomly throughout short simulation times. This is
depicted in the inset of figure 2 where the population evolution of the 2P1/2
state for a single calcium ion at rest is shown. When the same simulation is
repeated multiple times, the population averaged over the ensemble approaches
the continuous solution of the rate equations (1) and (2).

###  2.3 Equations of motion for a trapped ion

We assume that the motion of a single trapped ion in an inhomogeneous magnetic
field and under laser irradiation is subject to three forces: the electric
Lorentz force, the magnetic Lorentz force, and the scattering force. While the
scattering force is treated via the stochastic model described above, the
forces due to an electric field $\vec{E}$ and a magnetic field $\vec{B}$
acting an ion with mass $m$, charge $e$ and velocity $\vec{v}$ are
incorporated into Newtonian equations of motion,

$\frac{d\vec{v}}{dt}=\frac{e}{m}\left(\vec{E}+\vec{v}\times\vec{B}\right).\\\
$ (5)

We assume that the ion is confined in a harmonic RF trap such that the
electric field can be expressed as [50],

$\vec{E}=\frac{m\Omega_{\text{RF}}^{2}}{4e}\begin{pmatrix}(-a+2q\cos(\Omega_{\text{RF}}\
t))x\\\ (-a-2q\cos(\Omega_{\text{RF}}\ t))y\\\ 2az\\\ \end{pmatrix}.$ (6)

Here, $x,y,z$ are the position coordinates of the ion and $a=-\frac{4\kappa
eV_{\text{dc}}}{mz_{0}^{2}\Omega_{\text{RF}}^{2}}$ and
$q=-\frac{2eV_{\text{rf}}}{mr_{0}^{2}\Omega_{\text{RF}}^{2}}$ are the Mathieu
parameters which depend on the ion’s charge $e$ and mass $m$, the geometric
parameters $r_{0}$, $\kappa$, $z_{0}$ assuming a linear RF quadrupole trap
[48], the applied voltages $V_{\text{dc}}$ and $V_{\text{rf}}$ and the RF
angular frequency $\Omega_{\text{RF}}$. An integration scheme that is adequate
to numerically solve equation (5) is the Boris algorithm [51, 52, 53] which is
a finite difference method with second-order accuracy [53]. It only requires
one evaluation of the field per time step $\delta t$ and is stable for
oscillatory motion as it conserves phase space volume [51]. However, in
contrast to the widely used leapfrog scheme, the acceleration is allowed to be
velocity-dependent which is necessary to model the magnetic Lorentz force
[51]. Defining $t_{k}\coloneqq k\delta t$,
$\vec{x}_{k}\coloneqq\vec{x}(t_{k})$,
$\vec{v}_{k}\coloneqq\vec{v}(t_{k}-\delta t/2)$,
$\vec{E}_{k}\coloneqq\vec{E}(\vec{x}_{k})$ and
$\vec{B}_{k}\coloneqq\vec{B}(\vec{x}_{k})$, the Boris algorithm can be
implemented as [52]

$\begin{split}&\vec{v}^{\,-}=\vec{v}_{k}+\frac{q}{m}\vec{E}_{k}\frac{\delta
t}{2},\\\
&\vec{v}^{\,{}^{\prime}}=\vec{v}_{\,-}+\vec{v}^{\,-}\times\vec{t},\\\
&\vec{v}^{\,+}=\vec{v}_{\,-}+\vec{v}^{\,{}^{\prime}}\times\vec{s},\\\
&\vec{v}_{k+1}=\vec{v}^{\,+}+\frac{q}{m}\vec{E}_{k}\frac{\delta t}{2},\\\
&\vec{x}_{k+1}=\vec{x}_{k}+\vec{v}_{k+1}\delta t.\\\ \end{split}$ (7)

The temporary variables $\vec{v}^{\,-}$, $\vec{v}^{\,{}^{\prime}}$ and
$\vec{v}^{\,+}$ are defined in the first, the second and the third line of the
algorithm and the quantities $\vec{t}$ and $\vec{s}$ are defined as

$\vec{t}=\frac{q\delta
t}{2m}\vec{B}_{k},\;\;\text{and}\;\;\;\vec{s}=\frac{2}{1+|\vec{t}\,|^{2}}\vec{t}.$
(8)

###  2.4 Simulation parameters

Doppler laser cooling of a single calcium ion was studied in a hypothetical
hybrid trap composed of a linear-quadrupole RF trap and a quadrupolar magnetic
trap. For the simulations reported here, we used $\Omega_{\text{RF}}=8$ MHz,
$a=-3.18\cdot 10^{-4}$ and $q=-0.08$ which correspond to realistic parameters
of traps used in our laboratory [54]. The inhomogeneous $B$-field was assumed
to originate from two bar magnets in anti-Helmholtz configuration with
dimensions $3\times 4\times 6$ mm as used, e.g., in ref. [38]. Each magnet was
assumed to have a remanence of 1.64 T and the surface-to-surface distance
between the two bar magnets was taken as 3.6 mm. A sketch of the assumed setup
and a simulation of the $B$-field are shown in section B in the appendix.
Figures in this article show the average of 32 simulations with different
initial velocity vectors of the ion and with different sets of random numbers
used in the Monte Carlo model of the cooling force (see section 2.1). The ion
was initialised in the (4s) ${}^{2}S_{1/2},m_{j}=-1/2$ state and the initial
position of the ion was chosen at the centre of the hybrid trap. Initial
velocity vectors of the ions were sampled over random directions with their
norm satisfying the equipartition theorem such that the initial kinetic energy
of the ion was 1 K. Such a scenario can experimentally be realised by Doppler-
precooling the ion in the RF trap before it is overlapped with the magnetic
trap. Choosing an initial ion position slightly displaced from the hybrid trap
centre or assuming higher initial temperatures yielded qualitatively similar
results (see section C in the appendix).
If not otherwise mentioned, we assume two Gaussian laser beams, one for
cooling (subscript c) and one for repumping (subscript r), which propagate
along the trap axis ($z$ axis in figure 14 (b) in the appendix) with a power
of 0.5 mW (corresponding to saturation parameters $S_{\text{c}}=1.96$ and
$S_{\text{r}}=105.75$, respectively) and with $1/e^{2}$ waist radii of
$W_{\text{c}}=0.6$ mm and $W_{\text{r}}=1$ mm. If not otherwise mentioned, we
further assume laser detunings of $\delta_{\text{c}}=-30$ MHz and
$\delta_{\text{r}}=-10$ MHz, FWHM linewidths of
$L_{\text{c}}=L_{\text{r}}=0.3$ MHz and linear polarisations which are
parallel to the $x$ axis of the lab frame (see section B in the appendix).
Since a single ion is studied and only laser beams along the axial direction
of the trap are assumed, cooling in only one dimension is obtained as
discussed in the following sections. As in experiments without strong magnetic
fields, three-dimensional cooling can be achieved by setting the direction of
the cooling-laser beam at a finite angle to all three principal axes of the
trap or working with larger ensembles of ions in which the Coulomb interaction
couples all motional degrees of freedom [48].

##  3 Results and Discussion

###  3.1 Ion motion in combined electric radio-frequency and magnetic fields

A cold ion initialised close to the centre of the presently considered hybrid
trap has velocity components on the order of tens m/s and samples $B$-field
strengths less than 100 G (see section B in the appendix). For a calcium ion,
this results in a Lorentz force on the order of $10^{-19}$ to $10^{-20}$ N
which is comparable to the magnitude of the scattering force. However, with
laser cooling the Lorentz force becomes less pronounced over time as the
velocity of the ion as well as its motional amplitude and thereby the
magnitude of the experienced $B$-field decrease due to the cooling.
In the absence of a $B$-field, the motion of an ion in a linear RF trap is
determined by the Mathieu equations [50]. The resulting ion motion is a
combination of a slow component, termed secular motion, and a fast oscillatory
motion called micromotion. Micromotion originates from the RF fields and
occurs therefore only along the radial directions of the trap, along which the
RF fields are applied, but not the axial one. If a homogeneous $B$-field is
applied, the Lorentz force causes the ion to undergo cyclotron and magnetron
motions in the plane orthogonal to the $B$-field direction, especially at
large field strengths. In a quadrupolar magnetic field, the $B$-field has a
different magnitude and direction at every position. Cyclotron and magnetron
frequencies therefore also vary with the position. Therefore, we do not expect
to observe Fourier components with frequencies corresponding to well-defined
cyclotron and magnetron motions in the present case. Instead, we expect the
Lorentz force to cause a mixing of the radial and axial frequency components.
Moreover, since the magnetic Lorentz force is small compared to the confining
electric forces of the linear Paul trap, the secular and micromotions are
expected to dominate.

Figure 3: Fourier spectra of the motion of an ion trapped in a linear Paul
trap (a) in the absence of a $B$-field and (b) & (c) with an overlapped
quadrupolar magnetic field. The dominant features correspond to the
frequencies of the secular motion (101 kHz, 203.5 kHz), the micromotion (8
MHz), and its second harmonic (16 MHz). In the inhomogeneous $B$-field, the
motions along different axes mix with each other and produce peaks in the
Fourier spectrum at sum and difference frequencies.

Solving equation (5) numerically in the absence of laser beams confirms these
expectations. Without a magnetic field, four dominant features are observed in
the Fourier spectrum of the ion motion in figure 3. The peaks at 101 kHz and
203.5 kHz correspond to the axial and radial secular motions, respectively.
Since we assume an idealised ion trap, the secular frequencies of motion along
the two radial axes are degenerate. The peaks around 8 MHz and 16 MHz
correspond to the micromotion frequency and its second harmonic. The
micromotion is modulated by the secular motion and thus consists of two peaks
split by twice the radial secular frequency. In the hybrid trap, i.e.,
including the inhomogeneous $B$-field, the same secular and RF frequencies are
present but additional Fourier components at 102.5 kHz, 304.5 kHz and 407 kHz
appear which are the sum and difference frequencies between the secular
frequencies along different axes (figure 3 (b)). Under closer inspection,
additional peaks around 8 MHz can also be observed which correspond to the sum
and difference frequency of the modulation of the micromotion by the secular
motion (figure 3 (c)).

###  3.2 Laser-cooling dynamics of trapped ions in inhomogeneous $B$-fields

An ion at 1 K oscillates around the trap centre with amplitudes of up to 40
$\umu$m and,

Figure 4: (a) Example of the time evolution of the kinetic energy of an ion
along the axial direction (black trace) and its average over one period of the
secular motion (red trace). The inset shows the population of the eight Zeeman
sublevels over the course of the ion trajectory for the first 0.5 ms (see
figure 1 for labelling of the levels). (b) Averaged ion kinetic energies for
different experimental configurations. Green trace: without magnetic field;
red trace: cooling and the repumper lasers with linear polarisation and
aligned with the $x$ axis (same situation as in panel (a)); yellow-dashed
trace: linear polarisation aligned in the $\hat{x}+\hat{y}$ direction; blue
trace: left circular polarisation; light-blue trace: left circular
polarisation for an initial velocity vector with higher radial components
([4.80, -4.21, 24.11] m/s compared to [0.68, -0.89, -24.92] m/s used in the
other simulations). Laser detunings: $\delta_{\text{c}}=-30$ MHz,
$\delta_{\text{r}}=-10$ MHz.

thereby, samples $B$-field strengths that cause Zeeman splittings of up to 120
MHz (see figure 1). Despite the relatively large Zeeman splittings, efficient
laser cooling can be achieved with one cooling and one repumper laser, as
illustrated in figure 4. As a figure of merit for the cooling efficiency, we
adopt the time $t_{1/2}$ required to remove half of the ion’s initial kinetic
energy along the axial direction (henceforth dubbed ”half-life”). In each
simulation, the kinetic energy (black trace in figure 4 (a)) was averaged over
one period of the secular motion and half-lives were then obtained from these
averages (red trace in figure 4 (a)). In figure 5, the half-life is plotted
for different laser detunings.

Figure 5: Ion kinetic energy half-lives $t_{1/2}$ (time required to remove
half of the ion’s kinetic energy) at different cooling-laser
($\delta_{\text{c}}$) and repumper detunings ($\delta_{\text{r}}$) for a
single ion in the hybrid trap. Doppler cooling requires a red-detuned cooling
laser beam ($\delta_{\text{c}}<0$). The shortest cooling half-lives are found
between $\delta_{\text{c}}=-20$ MHz and $\delta_{\text{c}}=-60$ MHz and for
repumper laser detunings in a range of more than a hundred MHz around the
repumper transition resonance.

The fastest cooling is achieved when the cooling laser is detuned between -20
MHz and -60 MHz from the 2S${}_{1/2}-^{2}$P1/2 transition frequency at zero
$B$-field. The exact detuning of the repumper laser is less critical than the
detuning of the cooling laser since most absorption events occur between the
2S1/2 and the 2P1/2 states. As required for Doppler cooling, the cooling laser
must be red-detuned ($\delta_{\text{c}}<0$), otherwise heating of the ion
occurs. The inset in figure 4 shows how the internal state of the ion changes
over time under irradiation with linearly polarised laser beams. All Zeeman
sublevels are efficiently addressed so that no dark states arise in which the
population remains trapped. Absorption events occur across the whole ion
trajectory as shown in figure 6. Cooling transitions occur under an anti-
parallel projection of the ion’s velocity vector onto the laser propagation
direction. Such events are indicated by red dots in figure 6 and occur
significantly more often than heating transitions with a parallel projection
of the velocity onto the laser’s $k$-vector (black dots). This observation
highlights the importance of the Doppler shift in compensating the
inhomogeneous Zeeman shifts, similarly to the dynamics in a Zeeman slower
[40].

Figure 6: Locations in the lab frame at which absorption events of 397 nm
photons occurred along a representative ion trajectory. Events with an anti-
parallel (parallel) projection of the ion’s velocity vector onto the laser
propagation direction are depicted by red (black) dots. The initial velocity
vector of the ion was [0.68, -0.89, -24.92] m/s.

When using linear laser polarisations (red and yellow-dashed traces in figure
4 (b)), laser cooling in the hybrid trap is only slightly less efficient than
in the absence of a $B$-field (green traces in figure 4 (b)). Changing the
orientation of the linear polarisation vector has no noticeable effect on the
cooling efficiency. However, using circularly polarised laser beams results in
less efficient cooling, as depicted by the blue traces in figure 4. We
attribute this to the fact that the magnetic field in a quadrupolar magnetic
trap points predominantly parallel or anti-parallel to the laser beams along
the axial direction (see figure 15 in the appendix). For circular
polarisation, absorption events occurring on that axis are thus approximately
dominated by either pure $\sigma^{+}$ or $\sigma^{-}$ transitions depending on
the position of the ion with respect to the trap centre. In this scenario,
specific Zeeman components of the (3d) 2D3/2 level become ”dark” states that
cannot be addressed by the repumper laser beams. Thus, population remains
trapped impairing cooling. Linearly polarised beams, on the other hand, can
drive either $\sigma^{+}$ or $\sigma^{-}$ transitions, regardless of the
position of the ion on the axis. The effect of circular polarisation
diminishes for an ion with larger motional components in the radial plane
(light blue curve in figure 4) for which the $B$-field deviates more strongly
from a parallel alignment with the laser beam at increasing distance from the
axis. Such a configuration produces more diverse projections of the laser
polarisation onto the atomic frame also in the case of circular polarisation.

Figure 7: Dependency of the energy half-life on the linewidth of the cooling
laser $L_{\text{c}}$ and of the repumper laser $L_{\text{r}}$ for different
laser power spectral densities. The linewidth of the (a) cooling and (b)
repumper laser remained fixed while the (a) repumper and (b) cooling laser
linewidth was varied. For each specific linewidth, the saturation parameter
was chosen to produce the quoted laser power spectral densities. A decrease of
the half-life with increasing linewidth is only observable for low power
densities indicating that power broadening is sufficient to cover the required
spectral width for efficient laser cooling. Detunings of
$\delta_{\text{c}}=-30$ MHz and $\delta_{\text{r}}=-10$ MHz were assumed for
the fixed-frequency lasers.

In figure 7, the ion kinetic energy half-life is plotted for different laser
power spectral densities as a function of the cooling laser linewidth
$L_{\text{c}}$ while the repumper laser linewidth $L_{\text{r}}$ is fixed
(panel (a)) and vice versa (panel (b)). Increasing the power density at a
fixed linewidth results in shorter half-lives. When keeping the power density
fixed, an increase in linewidth reduces the half-life only for linewidths up
to a few MHz. This effect is hardly visible for the higher power densities
shown here which we attribute to power broadening.

###  3.3 Effect of trap misalignments

So far, an ideal experimental configuration has been studied in which the
centre of the ion trap and the centre of the magnetic trap are perfectly
overlapped. Experimentally, this condition is often challenging to achieve and
a finite displacement between the two trap centres is difficult to avoid. If
an offset between the trap centres exists, an ion oscillating around the ion-
trap centre does not experience a symmetric quadrupolar field which vanishes
at the centre of its trajectory. Instead, depending on the magnitude of the
offset, the $B$-field across the ion’s trajectory resembles more of a linear
gradient.

Figure 8: Effect of a misalignment between the RF and magnetic traps. An
increase in distance between the two trap centres along the positive axial
direction results in an increase in the energy half-life for laser parameters
that were found for optimal cooling in the case of a perfect overlap of the
traps. The inset shows the population of the eight Zeeman sublevels over the
course of an ion trajectory at an offset of 80 $\umu$m (see figure 1 for
labelling of the levels). Compared to the ideal case shown in figure 4 (a),
much fewer absorption events occur. The initial velocity vector of the ion was
[0.68, -0.89, -24.92] m/s.

The effect of such a trap displacement on the cooling efficiency is shown in
figure 8. An increase in the offset between the two trap centres results in an
increase of the half-life for one cooling and one repumper laser at parameters
that were found optimal for the ideal hybrid trap (see figure 4 (a)). A marked
deterioration of the half-life was found to occur already at displacements
exceeding 40 $\umu$m. The number of absorption events over the same period of
time also decreases with the magnitude of the trap displacement, which
suggests that the laser detunings need to be adjusted. However, scanning the
detuning and the polarisation of the cooling laser beam at a fixed finite
offset was not found to yield conditions for efficient cooling. We attribute
this to the range of Zeeman splittings sampled in this scenario which are too
large in order to be efficiently addressed by a single monochromatic cooling
laser beam. To mitigate this effect, a second cooling laser beam can be added
and the detunings of the two cooling lasers can be adjusted individually.

Figure 9: Ion kinetic energy half-lives $t_{1/2}$ (in ms) for different
detunings of two co-propagating cooling lasers at a relative trap displacement
of 80 $\umu$m along the axial direction. Efficient laser cooling at such a
trap displacement can be recovered by introducing a second cooling laser and
setting the detunings of the two lasers such that they deplete the two 2S1/2
Zeeman sublevels (e.g. $\delta_{\text{c,1}}=-150$ MHz and
$\delta_{\text{c,2}}=50$ MHz). Only the cooling transition
2S${}_{1/2}-^{2}$P1/2 was considered in this figure. Figure 10: Kinetic energy
along the axial direction of the ion motion (black trace) at a trap offset of
80 $\umu$m for two co-propagating cooling lasers and a single repumper laser.
The red trace depicts the average over the secular motion. The detunings of
the two cooling lasers were $\delta_{\text{c,1}}=-150$ MHz and
$\delta_{\text{c,2}}=50$ MHz. The repumper laser exhibited a detuning of
$\delta_{\text{r}}=0$ MHz and linear polarisation aligned with the $x$ axis.
No cooling occurs if the repumper laser has circular polarisation which is
shown in the inset for left circular polarisation.

To illustrate this point, we reduced the calcium ion to a hypothetical 4-level
system consisting of the 2S1/2 and the 2P1/2 Zeeman sublevels and scanned the
detunings of the two cooling lasers. The results of these simulations are
shown in figure 9. It can be seen that efficient cooling can be retrieved by
adding a second cooling laser and choosing the detunings such that transitions
out of both magnetic components of the 2S1/2 level are adequately addressed.
Considering again the full eight-level ion and choosing the detunings
$\delta_{c,1}=-150$ MHz and $\delta_{c,2}=50$ MHz for the two cooling lasers,
the effect of the repumper laser is studied. Figure 10 shows the kinetic
energy along the axial direction for a single repumper laser beam with linear
polarisation parallel to the $x$ axis. Despite large Zeeman splittings, a
single repumper laser with linear polarisation is sufficient to address the
2D${}_{3/2}-^{2}$P1/2 transitions without producing dark states. According to
figure 5, the population in the 2D3/2 levels can be sufficiently repumped even
when the laser is detuned by several tens of MHz. In contrast to the perfectly
overlapped hybrid trap, where circular laser polarisation does not necessarily
always lead to the occurrence of dark states as a consequence of the
inhomogeneity of the magnetic field, the field is much less inhomogeneous in
the presence of a trap offset. The $B$-field vector components along the axial
direction sampled by the ion all have the same sign. While linear polarisation
still drives both $\sigma_{+}$ and $\sigma_{-}$ transitions, circular
polarisation can only drive one of the two $\sigma$-transitions across the
whole ion trajectory in this situation. This results in dark states 2D3/2
Zeeman sublevels which prohibit laser cooling as shown in the inset.
Besides large Zeeman splittings across the whole ion trajectory, misalignments
of the two trap centres also have pronounced effects on the characteristics of
the ion motion. Figure 11 shows the trajectory of an ion in (a) & (c) the
ideal case with zero displacement and (b) & (d) with a displacement of 80
$\umu$m between the centre of the ion and the magnetic trap along the axial
direction. The three axes in a perfectly overlapped hybrid trap are only very
weakly coupled for a single ion such that its trajectory in the radial plain
remains in the direction of its initial velocity over the first hundreds of
microseconds. When the two trap centres are displaced, the $B$-field not only
becomes less inhomogeneous but also stronger in magnitude. In this situation,
the magnetic Lorentz force leads to motional components in the radial plain
that resemble cyclotron motion in Penning traps. It can thus be surmised that
a hybrid trap with a very large offset between the trap centres will exhibit
features reminiscent of a Penning trap.

Figure 11: Trajectory of an ion in the hybrid trap (a) & (b) over the course
of 100 $\umu$s and (c) & (d) over 400 $\umu$s for (a) & (c) a perfect overlap
between the ion and magnetic traps and for (b) & (d) a displacement of 80
$\umu$m along the positive axial direction between the trap centres of the ion
and magnetic trap. While the oscillatory motion of the ion in the radial plain
remains in the direction of the initial velocity vector over the course of
hundreds of microseconds in a perfectly overlapped hybrid trap, the trajectory
in the presence of a trap centre displacement shows signatures of cyclotron
motion reminiscent of Penning traps. The initial velocity vector of the ion
was [14.63, 15.18, 13.33] m/s.

##  4 Conclusion

Using an eight-level rate equation treatment for the state populations
combined with a molecular-dynamics framework, we studied theoretically the
population and motional dynamics of a single Ca+ ion in the combined
quadrupolar magnetic and electric radiofrequency fields of a hybrid trap under
the action of cooling and repumper laser beams. Laser cooling of a single cold
ion was found to work efficiently in the hybrid trap with laser parameters
commonly used for the Doppler cooling of trapped ions in the absence of a
$B$-field. If slight displacements between the centres of the ion trap and of
the quadrupolar magnetic field are introduced, as can be expected to be the
case in real experimental implementations, the ion motion starts to
increasingly sample linear $B$-field gradients rather than a quadrupolar
$B$-field configuration. In this scenario, the ion motion assumes cyclotron-
like components, and the laser cooling efficiency was found to markedly
deteriorate but can be recovered by employing additional cooling laser beams.

## Acknowledgments

We acknowledge financial support from the Swiss National Science Foundation,
grant nrs. 200021_204123 and TMAG-2_209193 as well as the University of Basel.

## Data availability

The codes used to produce the findings of this study are available on the
Zenodo repository with the identifier DOI: 10.5281/zenodo.7445811.

## References

  * [1] R.C. Thompson, S. Donnellan, D.R. Crick and D.M. Segal, J. Phys. B 42, 154003 (2009).
  * [2] K. Koo, J. Sudbery, D.M. Segal and R.C. Thompson, Phys. Rev. A 69, 043402 (2004).
  * [3] W. Neuhauser, M. Hohenstatt, P. Toschek and H. Dehmelt, Phys. Rev. Lett. 41, 233 (1978).
  * [4] W.M. Itano and D.J. Wineland, Phys. Rev. A 25, 35 (1982).
  * [5] H.F. Powell, D.M. Segal and R.C. Thompson, Phys. Rev. Lett. 89, 093003 (2002).
  * [6] I. Kozyryev, L. Baum, K. Matsuda, B.L. Augenbraun, L. Anderegg, A.P. Sedlack and J.M. Doyle, Phys. Rev. Lett. 118, 173201 (2017).
  * [7] J. Lim, J.R. Almond, M.A. Trigatzis, J.A. Devlin, N.J. Fitch, B.E. Sauer, M.R. Tarbutt and E.A. Hinds, Phys. Rev. Lett. 120, 123201 (2018).
  * [8] C. Zimmer, P. Yzombard, A. Camper and D. Comparat, Phys. Rev. A 104, 023106 (2021).
  * [9] A. Albrecht, A. Retzker, C. Wunderlich and M.B. Plenio, New J. Phys. 13 (3), 033009 (2011).
  * [10] P. Yzombard, M. Hamamda, S. Gerber, M. Doser and D. Comparat, Phys. Rev. Lett. 114, 213001 (2015).
  * [11] S.X. Wang, J. Labaziewicz, Y. Ge, R. Shewmon and I.L. Chuang, Appl. Phys. Lett 94 (9), 094103 (2009).
  * [12] M. Johanning, A. Braun, N. Timoney, V. Elman, W. Neuhauser and C. Wunderlich, Phys. Rev. Lett. 102, 073004 (2009).
  * [13] A. Khromova, C. Piltz, B. Scharfenberger, T.F. Gloger, M. Johanning, A.F. Varón and C. Wunderlich, Phys. Rev. Lett. 108, 220502 (2012).
  * [14] S. Weidt, J. Randall, S.C. Webster, K. Lake, A.E. Webb, I. Cohen, T. Navickas, B. Lekitsch, A. Retzker and W.K. Hensinger, Phys. Rev. Lett. 117, 220501 (2016).
  * [15] C. Ospelkaus, U. Warring, Y. Colombe, K.R. Brown, J.M. Amini, D. Leibfried and D.J. Wineland, Nature 476, 181 (2011).
  * [16] U. Warring, C. Ospelkaus, Y. Colombe, R. Jördens, D. Leibfried and D.J. Wineland, Phys. Rev. Lett. 110, 173002 (2013).
  * [17] T.P. Harty, M.A. Sepiol, D.T.C. Allcock, C.J. Ballance, J.E. Tarlton and D.M. Lucas, Phys. Rev. Lett. 117, 140501 (2016).
  * [18] H. Hahn, G. Zarantonello, M. Schulte, A. Bautista-Salvador, K. Hammerer and C. Ospelkaus, Npj Quantum Inf. 5 (1), 70 (2019).
  * [19] G. Zarantonello, H. Hahn, J. Morgner, M. Schulte, A. Bautista-Salvador, R.F. Werner, K. Hammerer and C. Ospelkaus, Phys. Rev. Lett. 123, 260503 (2019).
  * [20] R. Srinivas, S.C. Burd, H.M. Knaack, R.T. Sutherland, A. Kwiatkowski, S. Glancy, E. Knill, D.J. Wineland, D. Leibfried, A.C. Wilson, D.T.C. Allcock and D.H. Slichter, Nature 597 (7875), 209–213 (2021).
  * [21] A.L. Migdall, J.V. Prodan, W.D. Phillips, T.H. Bergeman and H.J. Metcalf, Phys. Rev. Lett. 54, 2596–2599 (1985).
  * [22] J.D. Weinstein, R. de Carvalho, T. Guillet, B. Friedrich and J.M. Doyle, Nature 395, 148 (1998).
  * [23] J. Pérez-Ríos and A.S. Sanz, Am. J. Phys. 81 (11), 836–843 (2013).
  * [24] E.L. Raab, M. Prentiss, A. Cable, S. Chu and D.E. Pritchard, Phys. Rev. Lett. 59, 2631 (1987).
  * [25] E.S. Shuman, J.F. Barry and D. DeMille, Nature 467, 820 (2010).
  * [26] M. Tarbutt, New J. Phys. 17 (1), 015007 (2015).
  * [27] J.A. Devlin and M.R. Tarbutt, New J. Phys. 18 (12), 123017 (2016).
  * [28] S. Willitsch, Proc. Int. Sch. Phys. Enrico Fermi 189, 255 (2015).
  * [29] M. Tomza, K. Jachymski, R. Gerritsma, A. Negretti, T. Calarco, Z. Idziaszek and P.S. Julienne, Rev. Mod. Phys. 91, 035001 (2019).
  * [30] C. Zipkes, S. Palzer, C. Sias and M. Köhl, Nature 464, 388 (2010).
  * [31] S. Schmid, A. Härter and J. Hecker Denschlag, Phys. Rev. Lett. 105, 133202 (2010).
  * [32] Z. Meir, T. Sikorsky, R. Ben-shlomi, N. Akerman, Y. Dallal and R. Ozeri, Phys. Rev. Lett. 117, 243401 (2016).
  * [33] J. Joger, H. Fürst, N. Ewald, T. Feldker, M. Tomza and R. Gerritsma, Phys. Rev. A 96 (3), 030703 (2017).
  * [34] W.W. Smith, O.P. Makarov and J. Lin, J. Mod. Opt. 52, 2253 (2005).
  * [35] A.T. Grier, M. Cetina, F. Oručević and V. Vuletić, Phys. Rev. Lett. 102, 223201 (2009).
  * [36] F.H.J. Hall, M. Aymar, N. Bouloufa-Maafa, O. Dulieu and S. Willitsch, Phys. Rev. Lett. 107, 243202 (2011).
  * [37] W.G. Rellergert, S.T. Sullivan, S. Kotochigova, A. Petrov, K. Chen, S.J. Schowalter and E.R. Hudson, Phys. Rev. Lett. 107, 243201 (2011).
  * [38] D. Haas, C. von Planta, T. Kierspel, D. Zhang and S. Willitsch, Commun. Phys. 2 (1), 101 (2019).
  * [39] M.S. Safronova and U.I. Safronova2011, Phys. Rev. A 83, 012503 (2011).
  * [40] C.F. Foot, _Atomic Physics_ (Oxford University Press, Oxford, 2005).
  * [41] C.B. Zhang, D. Offenberg, B. Roth, M.A. Wilson and S. Schiller, Phys. Rev. A 76, 012719 (2007).
  * [42] M.T. Bell, A.D. Gingell, J. Oldham, T.P. Softley and S. Willitsch, Faraday Discuss. 142, 73 (2009).
  * [43] K. Okada, M. Wada, T. Takayanagi, S. Ohtani and H.A. Schuessler, Phys. Rev. A 81, 013420 (2010).
  * [44] I. Rouse and S. Willitsch, Phys. Rev. A 92, 053420 (2015).
  * [45] M. Marciante, C. Champenois, A. Calisti, J. Pedregosa-Gutierrez and M. Knoop, Phys. Rev. A 82, 033406 (2010).
  * [46] D. Comparat, Phys. Rev. A 89, 043410 (2014).
  * [47] S. Xu, M. Xia, R. Gu, Y. Yin, L. Xu, Y. Xia and J. Yin, Phys. Rev. A 99, 033408 (2019).
  * [48] S. Willitsch, Int. Rev. Phys. Chem. 31, 175 (2012).
  * [49] H. Oberst, Master’s thesis, University of Innsbruck 1999.
  * [50] F.G. Major, V.N. Gheorghe and G. Werth, _Charged Particle Traps_ (Springer, Berlin and Heidelberg, 2005).
  * [51] H. Qin, S. Zhang, J. Xiao, J. Liu, Y. Sun and W.M. Tang, Phys. Plasmas 20 (8), 084503 (2013).
  * [52] C. Birdsall and A. Langdon, _Plasma Physics via Computer Simulation_ (CRC Press, Boca Raton, Fla, 2018).
  * [53] G. Penn, P.H. Stoltz, J.R. Cary and J. Wurtele, J. Phys. G 29 (8), 1719 (2003).
  * [54] C. von Planta, Ph. D. thesis, University of Basel, 2020.
  * [55] A.D. Gingell, M.T. Bell, J.M. Oldham, T.P. Softley and J.M. Harvey, J. Chem. Phys. 133, 194302 (2010).
  * [56] E. Dijck, Ph. D. thesis, University of Groningen, 2020.
  * [57] H.R. Gray, R.M. Whitley and C.R. Stroud, Opt. Lett. 3 (6), 218–220 (1978).
  * [58] R. Engel-Herbert and T. Hesjedal, J. Appl. Phys. 97, 074504 (2005).

##  Appendix A Rate equations vs. optical Bloch equations

In order to verify the rate equation (RE) model and identify its limitations,
we compared the computed population dynamics to the solutions of optical Bloch
equations (OBE) [49, 55, 56]. In this treatment, we solved the Liouville
equation

$\frac{\text{d}\rho}{\text{d}t}=-\frac{\text{i}}{\hbar}[H,\rho]+L(\rho)$ (9)

for the eight-level system in the calcium ion and computed the evolution of
the density matrix $\rho$ for different laser parameters and $B$-fields. The
Hamiltonian $H=H_{\text{A}}+H_{\text{I}}$ consists of the unperturbed atomic
Hamiltonian $H_{\text{A}}$ and the interaction Hamiltonian $H_{\text{I}}$.
Dissipative processes like spontaneous emission and finite laser linewidths
are included in the Lindblad operator $L(\rho)$. In figure 12, the diagonal
elements of $\rho$ according to equation (9) are compared to the solutions of
equations (1) and (2) in the main text. Two Zeeman sublevels of each the (4s)
2S1/2 and (3d) 2D3/2 states are plotted and different laser polarisations and
$B$-field orientations are explored. Rate equations and OBE were found to
match almost perfectly. In particular, the population follows the selection
rules for different polarisations with respect to the $B$-field direction, and
slower evolution is observed for stronger $B$-field strengths due to larger
Zeeman splittings.

d

Figure 12: The time evolution of selected state populations of a calcium ion
at rest. Solutions obtained via rate equations (dashed lines) match with the
solutions of optical Bloch equations (solid lines) for circular (first row)
and linear (second row) laser polarisation at different $B$-field strengths
and directions. One cooling and one repumper laser were assumed to propagate
along the $z$ axis with saturation parameters of $S_{\text{c}}=1.96$,
$S_{\text{r}}=105.75$, detunings of $\delta_{\text{c}}=-30$ MHz,
$\delta_{\text{r}}=-10$ MHz and linewidths of $L_{\text{c}}=0.3$ MHz,
$L_{\text{r}}=0.3$ MHz.

However, there are situations in which larger discrepancies between the rate-
equation and OBE treatments can be observed. For instance, coherent population
trapping (CPT) occurs if two lasers that drive a lambda system exhibit the
same detuning [57]. In this situation, a superposition state composed of the
two ground states of the lambda system is generated. This effect arises due to
the coherences between atomic states which are modelled by the OBE but not by
rate equations. In the 8-level calcium ion, several lambda systems can be
found. CPT effects can either occur between (4s) 2S1/2 and (3d) 2D3/2 Zeeman
sublevels or between two (3d) 2D3/2 Zeeman sublevels if two repumper lasers
are used. Two examples of lambda systems that can sustain CPT in the calcium
ion are shown in figure 13. The population evolution calculated by rate
equations and by OBE is also shown for laser parameters at which CPT occurs.
While the detuning depends only on the laser frequency and the Zeeman shift
for an ion at rest, the detuning of a moving ion depends also on the Doppler
shift. In trajectory simulations of an ion in an inhomogeneous $B$-field, the
ion constantly changes position and velocity and thus experiences different
Zeeman and Doppler shifts at each time step. Thus, despite being present in
our system, we regard CPT effects as negligible due to the motional dynamics.
Overall, we conclude that the rate equation model presented in section 2.2 of
the main text is appropriate to study the population dynamics in the present
case.

Figure 13: Two scenarios for CPT conditions in an eight-level system in (a)
S-P-D and (b) D-P-D lambda systems. (c) When the CPT conditions are met, rate
equations and OBE give different solutions as shown with the example of two
counter-propagating cooling and two counter-propagating repumper laser beams
corresponding to the scenario shown in (a). The lasers propagate in the same
direction as a 10 G $B$-field and have saturation parameters of
$S_{\text{c}}=1$, $S_{\text{r}}=100$, detunings of $\delta_{\text{c}}=-30$
MHz, $\delta_{\text{r}}=0$ MHz, linewidths of $L_{\text{c}}=0$ MHz,
$L_{\text{r}}=0$ MHz, and circular polarisation.

##  Appendix B  Assumed experimental setup

Figure 14 shows a schematic of a prototypical hybrid trap assumed in the
present simulations. The linear RF trap is composed of four cylindrical
electrodes for the application of radio-frequency fields and two endcap
electrodes for static fields to close the trap along the axial direction. The
magnetic trap overlapped with the ion trap is assumed to be composed of two
bar magnets. The $x$ and $y$ axes point toward two RF electrodes while the $z$
axis lies parallel to the trap axis as indicated. This coordinate system
defines the lab frame used in the equations of motion of the ion (equation (5)
in the main text) and has its origin at the centre of the hybrid trap. Special
care must be taken to match the lab frame with the frame given by the
$k$-vector of a laser beam and with the atomic frame (see section 2.2 in the
main text). Moreover, we used a coordinate system
$X^{\prime}Y^{\prime}Z^{\prime}$ in which the axes coincidence with the sides
of the bar magnets ($X^{\prime}=-(x+y)/\sqrt{2},\ Y^{\prime}=z,\
Z^{\prime}=(y-x)/\sqrt{2}$) for the magnetic trap. Figure 15 (a) shows the
magnetic vector field in the radial plain at $Y^{\prime}=z=0$ and (b) the
$B$-field strength in the axial direction in this coordinate system according
to the analytical expressions given in reference [58]. The $B$-field exhibits
gradients $\delta B/\delta X^{\prime}=205$ T/m, $\delta B/\delta
Y^{\prime}=85$ T/m, and $\delta B/\delta Z^{\prime}=290$ T/m with respect to
the trap centre.

Figure 14: Schematic of the assumed prototypical hybrid trap setup from (a) a
side view and (b) a frontal view. The hybrid trap is composed of a linear Paul
trap and two bar magnets. The laboratory frame for the ion ($x,y,z$) and a
coordinate system used to describe the magnetic fields
($X^{\prime},Y^{\prime},Z^{\prime}$) are shown in (b). See the text for the
exact definitions of the coordinate systems. Figure 15: Quadrupolar $B$-field
produced by the magnetic trap. (a) Vector field in the radial plain at
$Y^{\prime}=0$ and (b) $B$-field strength along the axial direction of the ion
trap.

##  Appendix C Simulation results at different initial conditions

In the main text, the initial position of the ion was chosen at the centre of
the hybrid trap. Figure 16 shows the average of 32 simulations, each with a
different initial velocity vector corresponding to a temperature of 1 K, for
an initial position 10 $\umu$m from the trap centre along the positive axial
direction. Qualitatively the same results as for an ion with an initial
position at the trap centre are obtained (compare with figure 5 of the main
text).

Figure 16: Ion kinetic energy half-lives $t_{1/2}$ at different laser
detunings for one cooling and one repumper laser beam propagating along the
axial direction of the hybrid trap. The initial position of the ion is 10
$\umu$m from the trap centre. Similar results are obtained as for an ion with
an initial position at the trap centre (compare with figure 5 of the main
text). The laser parameters used here were $S_{\text{c}}=1.96$,
$S_{\text{r}}=105.75$, $L_{\text{c}}=0.3$ MHz, $L_{\text{r}}=0.3$ MHz and
linear polarisation along the $x$ axis.

In the main text, the initial velocity vectors of the ion were chosen such
that they correspond to 1 K according to the equipartition theorem. Figure 17
shows the kinetic energy along the axial direction for an ion in the hybrid
trap with an initial velocity vector that corresponds to 10 K. Laser cooling
is also possible at higher initial temperatures but, not surprisingly, more
time is required.

Figure 17: Time evolution of the kinetic energy of an ion along the axial
direction (black trace) and its average over the secular frequency (red
trace). The inset shows the population of the eight Zeeman sublevels over the
course of the ion trajectory for the first 0.5 ms (see figure 1 in the main
text for labelling of the levels). The initial velocity vector was [-43.14,
-43.96, 49.28] m/s which corresponds to 10 K according to the equipartition
theorem. The laser parameters used here were $S_{\text{c}}=1.96$,
$S_{\text{r}}=105.75$, $\delta_{\text{c}}=-30$ MHz, $\delta_{\text{r}}=-10$
MHz, $L_{\text{c}}=0.3$ MHz, $L_{\text{r}}=0.3$ MHz and linear polarisation
along the $x$ axis.


# Streaming CityJSON datasets

Hugo Ledoux  Gina Stavropoulou  Balázs Dukai

###### Abstract

We introduce _CityJSON Text Sequences_ (CityJSONSeq in short), a format based
on _JSON Text Sequences_ and CityJSON. CityJSONSeq was added to the CityJSON
version 2.0 standard to allow us to stream very large 3D city models. The main
idea is to decompose a CityJSON dataset into its individual city objects (each
building, each tree, etc.) and create several independent JSON objects of a
newly defined type: CityJSONFeature. We elaborate on the engineering decisions
that were taken to develop CityJSONSeq, we present the open-source software we
have developed to convert to and from CityJSONSeq, and we discuss different
aspects of the new format, eg filesize, usability, memory footprint, etc. For
several use-cases, we consider CityJSONSeq to be a better format than CityJSON
because: (1) once serialised it is about 10% more compact; (2) it takes an
order of magnitude less time to process; and (3) it uses significantly less
memory.

##  1 Introduction

CityJSON is a JSON-based encoding for storing 3D city models that implements a
subset of the CityGML data model version 3.0 [OGC, 2021a]. As further
described in Ledoux et al. [2019], its development started in 2017 with the
aim of offering an easy-to-use and web-ready alternative to the XML-encoded
CityGML files [OGC, 2023a], which in practice can be rather verbose, difficult
to parse, and complex to manipulate. The first official release of CityJSON
(version 1.0) was a success:

  1. 1.

its JSON-based files were on average around 7 times more compact than their
CityGML-XML equivalents without loss of information. See Ledoux et al. [2019]
and https://www.cityjson.org/filesize/ for details, and also Praschl and
Krauss [2023] for a comparison with standard computer graphics formats;

  2. 2.

it was adopted as an OGC Community Standard [OGC, 2021b];

  3. 3.

it was adopted by the Dutch government as a 3D standard to distribute
nationwide 3D datasets;

  4. 4.

several implementations and plugins have been developed, most notably FME.

However, the version 1.0 of CityJSON had one limitation: its structure for
storing the coordinates of the geometries (see Figure 1) made the _streaming_
of very large datasets complex, if not impossible. As further defined in
Section 3, streaming refers to the possibility of
downloading/transferring/processing a dataset without having to load it all in
memory. Given the increasing size of datasets of 3D cities, with CityGML-XML
files often exceeding 2GB, the processing of CityJSON files has become a
practical challenge.

We present in this paper _CityJSON Text Sequences_ (henceforth referred to as
_CityJSONSeq_), a format based on _JSON Text Sequences_ [Williams, 2015] and
CityJSON, and inspired by _GeoJSON Text Sequences_ [Gillies, 2017].
CityJSONSeq was added to the CityJSON version 2.0 standard that was released
in 2023 (and also standardised by the OGC, see OGC [2023b]). As further
described in Section 4, the idea is to decompose a (often large) CityJSON file
into its individual _features_ (eg each Building, each Bridge, etc.) and
create several JSON objects of a newly defined type CityJSONFeature. These
objects are either serialised into a text file, or streamed from a server to
client or from one application to another. This allows us to avoid a large
list of vertices that need to be indexed, as it is the case with CityJSON
files (see Section 2 for details).

Figure 1: An example of a CityJSON file. The vertices are stored in a global
list, and the position of the vertices in that list are used to represent the
boundaries of the geometries (represented by the arrows, many have been left
out for clarity).

In Section 5, we describe the open-source software we have developed to
convert between CityJSON and CityJSONSeq files. We also analyse the filesizes
of CityJSON and CityJSONSeq for several real-world datasets and synthetic
datasets we built. It can be observed that one advantage of CityJSONSeq,
besides that files containing several thousands of features can be streamed,
is that it compresses further the CityJSON files by around 12%, sometimes
more. We discuss in Section 5 the reasons for this interesting finding.

##  2 Structure of a CityJSON file

As shown in Figure 1, a CityJSON object, which is a JSON object, represents a
given geographical area, and it typically contains the following JSON
properties:

  1. 1.

"type": it must be "CityJSON";

  2. 2.

"version": "2.0" is the current version;

  3. 3.

"metadata": different metadata related to the dataset can be stored. The most
important is the definition of the coordinate reference system (CRS).

  4. 4.

"transform": CityJSON "vertices" are compressed and stored as integers only.
The parameters of this property allow us to convert from those integers back
to real-world coordinates.

  5. 5.

"CityObjects": a dictionary where the properties are the identifiers of the
city objects (_IDs_), which are any CityGML city object (for instance a
Building, a BuildingPart, a SolitaryVegetationObject, etc.). The city objects
are listed one after the other, even if some are "children" of others. As an
example, for a Building containing 2 parts, the 3 objects will be represented
at the same level and linked by their _IDs_ , as shown in Figure 2. The schema
is thus flat and all hierarchies have been removed. Each city object can have
a "parents" and/or a "children" property, and this is how in the snippet the
building "id-1" is linked to its 2 parts. The fact that a dictionary is used
means that developers have direct access to the city objects through their IDs
(and also in constant time if a hashmap is used to implement the dictionary
while parsing the file).

  6. 6.

"vertices": The 3D geometric primitives in CityJSON are those of the CityGML
data model, which means that multi/composite solids with several parts and/or
cavities are supported. A geometric primitive does not list all the
coordinates of its vertices, instead the coordinates of the vertices are
stored in a separate array (the "vertices" property of the CityJSON object),
and the geometric primitives refer to the position of a vertex in that array.
This indexing mechanism has been successfully used for many years by the
computer graphics community in formats as _Wavefront OBJ_
111https://en.wikipedia.org/wiki/Wavefront˙.obj˙file. There are several
advantages to this approach. First, the files can be compressed: 3D vertices
are often shared by several surfaces, and repeating them can be costly,
especially if they are very precise (sub-millimetre precision is often used).
Second, this approach increases the topological relationships that are
explicitly stored in the file, and several operations (eg determining building
adjacency) can be sped up and made more robust. Third, it is very easy to
convert all coordinates to a representation listing; the inverse is not true.
However, this list of vertices is the reason why the streaming of geometries
is problematic, since in practice it can contain several millions vertices. To
be able to reconstruct a single Building, all the "vertices" need to loaded in
memory, which can mean waiting for millions of unused vertices to be
deserialised.

  7. 7.

"appearances": Both textures and materials for surfaces are supported. The
material of a surface is represented with the X3D
specifications222https://en.wikipedia.org/wiki/X3D, and for the textures the
COLLADA specifications333https://www.khronos.org/collada/ are reused.

  8. 8.

"geometry-templates": Geometry templates are geometries defined once and
reused by applying a translation, a rotation, and/or a scaling. They are
mostly used for city objects like trees, bus stops, and lamp posts.

⬇

1 "CityObjects": {

2 "id-1": {

3 "type": "Building",

4 "attributes": {...},

5 "children": ["id-2", "id-3"],

6 "geometry": [{...}]

7 },

8 "id-2": {

9 "type": "BuildingPart",

10 "parents": ["id-1"],

11 "geometry": [{...}]

12 ...

13 },

14 "id-3": {

15 "type": "BuildingPart",

16 "parents": ["id-1"],

17 "geometry": [{...}]

18 ...

19 }

20 ...

21 "id-77": {}

22 }

Figure 2: CityJSON mechanism to flatten out the schema: the city objects are
stored in a flat list, and they are linked together with the properties
"parents" and "children".

##  3 Streaming (3D) datasets

Figure 3: The CityJSONSeq of a CityJSON dataset with two buildings contains
three JSON objects: one for the metadata, plus one for each building.

In the context of geo-information, a _stream_ is a sequence of data that is
available over a period of time, and “can be thought of as items on a conveyor
belt being processed one at a time rather than in large batches”444From
https://en.wikipedia.org/wiki/Stream˙(computing).

For GML-based formats (which are feature-centric), modifying a file for the
purpose of streaming is usually a simple task that involves sending the
features in the dataset one-by-one. However, notice that this is only true for
GML files that follow the Simple Feature paradigm [OGC, 2006]. For more
complex data models like CityGML, where geometry templates and _XLinks_ are
used, streaming often requires a large amount of pre-processing. _XLinks_ are
links between elements in a file (similar to _pointers_ in a computer
program), a concrete example in a CityGML file is a cube that lists the
geometries of 5 of its surfaces, but its 6th surface is simply a link to
another surface somewhere else in the file (which belongs to another building
for instance). If the linked surface has not be seen in the stream yet, the
receiver cannot process the cube and needs to wait for that specific 6th
surface to appear (eg to calculate its volume). It is not always possible to
(re-)order a CityGML file so that all the references can be resolved without
having to store extra information until it appears in the stream. However, it
is always possible to resolve the _XLinks_ before streaming a dataset (that
is, in our example, copy the geometry of the 6th surface to the cube), but
this means that the filesize will increase, and that converting back to the
original file will not be possible.

For the _GeoJSON_ format [Butler et al., 2016], which follows the Simple
Feature paradigm, creating a stream is trivial since each of the features in
the dataset becomes one JSON object serialised to one line [Gillies, 2017].
There are no links possible between features, each JSON object is independent.

For formats that use a global indexing of vertices, such as CityJSON and most
formats used for storing meshes in computer graphics (eg OBJ and STL), the
reorganisation of the elements in a file is more complex but nonetheless
possible. Isenburg et al. [2003] describe algorithms and tools that interleave
the vertices and faces in a file (instead of having one large list of vertices
at the end) and add simple tags to inform that specific vertices are not used
anymore in the stream (and thus can be freed from memory). This allows us, in
theory, to process/edit/manipulate infinitely large meshes, since they never
have to be completely loaded in memory. The idea is exemplified by the
construction of gridded terrains that are gigabytes in size [Isenburg et al.,
2006]. However, this cannot be implemented in CityJSON directly because all
the vertices need to be listed in the JSON property "vertices".

##  4 CityJSON Text Sequences

As shown in Figure 3, a CityJSONSeq decomposes a CityJSON object into its
features to create a sequence of several JSON objects. Those JSON objects are
of type CityJSONFeature, which allows the storage of a single feature, for
instance a Building, together with its “children” objects (eg a BuildingPart
and/or a BuildingInstallation). Each feature is independent, it has its own
list of vertices (which is thus _local_ to the JSON object, and is usually
rather small, see next section for details) and its own textures and materials
(if any). The allowed properties are shown in Figure 4; notice that the "id"
property is used to clearly identity the “parent” of the feature, in case
there are children.

⬇

1{

2 "type": "CityJSONFeature",

3 "id": "id-1",

4 "CityObjects": {

5 "id-1": {

6 "type": "Building",

7 "attributes": {

8 "roofType": "gabled roof"

9 },

10 "children": ["mybalcony"],

11 "geometry": [...]

12 },

13 "mybalcony": {

14 "type": "BuildingInstallation",

15 "parents": ["id-1"],

16 "geometry": [...]

17 }

18 },

19 "appearance": {...}

20 "vertices": [...]

21}

Figure 4: An example of a CityJSONFeature for a Building with a balcony
referenced in its "children" property.

CityJSONSeq follows the specifications of ndjson (newline delimited
JSON)555https://github.com/ndjson/ndjson-spec/ and two constraints are added
for handling CityJSON:

  1. 1.

each JSON Object must conform to the _JSON Data Interchange Format
specifications_ [Bray, 2017] and be written as a UTF-8 string;

  2. 2.

each JSON Object must be followed by a new-line (LF: "\n") character, and it
may be preceded by a carriage-return (CR: "\r");

  3. 3.

a JSON Object must not contain the new-line or carriage-return characters;

  4. 4.

the first JSON Object must be of type CityJSON;

  5. 5.

the following JSON Objects must be of type CityJSONFeature.

Note that a CityJSONFeature object does not contain all the information that
is required for reconstructing the feature. Most commonly, the "transform"
property, the CRS, and the "geometry-templates" must be known in order to
correctly reconstruct and georeference the city objects. The rule #4 ensures
that those are available. The CityJSON object must contain a "transform"
property and eventually the other properties if needed; "CityObjects" and
"vertices" must be present but they must be empty (to ensure that the JSON
object is valid).

The CityJSONSeq for Figure 3 is shown in Figure 5.

⬇

1 {"type":"CityJSON","version":"2.0","transform":
{"scale":[1.0,1.0,1.0],"translate":[0.0, 0.0,
0.0]},"metadata":{"referenceSystem":"https://www.opengis.net/def/crs/EPSG/0/7415"},"CityObjects":{},"vertices":[]}

2 {"type":"CityJSONFeature","id":"id-1","CityObjects":{...},"vertices":[...]}

3 {"type":"CityJSONFeature","id":"id-2","CityObjects":{...},"vertices":[...]}

Figure 5: An example of a CityJSONSeq stream containing 3 features.

##  5 Experiments with real-world datasets

To convert between CityJSON and CityJSONSeq files (and vice-versa), we have
developed the open-source software _cjseq_ , which is available at
https://github.com/cityjson/cjseq/ under a permissive open-source license. The
command-line program handles the conversion not only of the geometries, but
also of the materials, the textures, and the geometry templates that the
dataset could contain. It includes three sub-commands:

  1. 1.

cat: CityJSON $\rightarrow$ CityJSONSeq;

  2. 2.

collect: CityJSONSeq $\rightarrow$ CityJSON;

  3. 3.

filter: to filter city objects in a CityJSONSeq, randomly or based on a
bounding box.

It should be observed that the conversion is an efficient process: the rather
large dataset _Helskinki_ from Table 1, which contains more than 77000
buildings and whose CityJSON file is 572, takes only 4.7sec to be converted to
a CityJSONSeq file, and the reverse operation takes 5.7sec (on a standard
laptop).

###  5.1 Filesize comparison

Table 1: The datasets used for the benchmark.

|  | dataset |  | size of file |  | vertices
---|---|---|---|---|---|---
|  | CityObjects |  app.${}^{\text{(a)}}$ |  | CityJSON | CityJSONSeq |  compr.${}^{\text{(b)}}$ |  | total |  largest${}^{\text{(c)}}$ |  shared${}^{\text{(d)}}$
3DBAG |  |  1110 bldgs |  |  |  6.7 |  5.9 | 12% |  | $82\,509$ | $4112$ | 0.1%
3DBV |  |  71634 misc |  |  |  378 |  317 | 16% |  | $4\,110\,319$ | $116\,670$ | 21.0%
Helsinki |  |  77231 bldgs |  |  |  572 |  412 | 28% |  | $3\,038\,576$ | $2202$ | 0.0%
Helsinki_tex |  |  77231 bldgs | tex |  |  713 |  644 | 10% |  | $3\,038\,576$ | $2202$ | 0.0%
Ingolstadt |  |  55 bldgs |  |  |  4.8 |  3.8 | 25% |  | $87\,972$ | $12\,800$ | 0.0%
Montréal |  |  294 bldgs | tex |  |  5.4 |  4.6 | 15% |  | $31\,585$ | $3393$ | 2.0%
NYC |  |  23777 bldgs |  |  |  105 |  95 | 10% |  | $1\,035\,804$ | $2608$ | 0.8%
Railway |  |  50 misc | tex+mat |  |  4.3 |  4.0 | 8% |  | $73\,554$ | $14\,966$ | 0.4%
Rotterdam |  |  853 bldgs | tex |  |  2.6 |  2.7 | -4% |  | $22\,246$ | $631$ | 20.0%
Vienna |  |  307 bldgs |  |  |  5.4 |  4.8 | 11% |  | $47\,220$ | $2025$ | 0.0%
Zürich |  |  52834 bldgs |  |  |  279 |  247 | 11% |  | $3\,472\,989$ | $4069$ | 2.6%

  * •

${}^{\text{(a)}}$ appearance: ‘tex’ is textures stored; ‘mat’ is material
stored

  * •

${}^{\text{(b)}}$ compression factor is
$\frac{size(CityJSON)-size(CityJSONSeq)}{size(CityJSON)}$

  * •

${}^{\text{(c)}}$ number of vertices in the largest feature of the stream

  * •

${}^{\text{(d)}}$ percentage of vertices that are used to represent different
city objects

We have converted with _cjseq_ several publicly available files, and Table 1
shows an overview of the files stored both in CityJSON and CityJSONSeq. The
files are available in the reproducibility repository of the
paper666https://github.com/cityjson/paper˙cjseq.

First observe that—contrary to intuition—the filesize of a dataset serialised
as a CityJSONSeq file is around 12% compacter than serialised as a CityJSON
file, and in the case of _Helsinki_ it is 28%. An even larger compression
factor is noted in most datasets whose texture, materials, semantics and
attributes have been removed. The main reason for this is that the indices of
the vertices are low integers for each feature (because the lowest index in
each feature is always “0” and is incremented by 1 until the total number of
vertices), and they do not increase to very large integers in contrast to the
vertices in CityJSON. For instance, the dataset _Helsinki_ contains a total of
more than 3 millions vertices, but its largest feature contains only but 2202
vertices. The fact that many indices are used for representing the geometries
(and the textures) means that if several large numbers are used then the
filesize will grow; if the maximum vertex index is around 2000 for each
feature then the filesize will be reduced.

Only one dataset sees its filesize slightly increase, by 4%, when serialised
to a CityJSONSeq file: _Rotterdam_. The reasons for the increase (or decrease)
are many, and we discuss in the following the 3 most relevant: (1) the total
number of vertices; (2) the number of shared vertices; (3) the presence of
textures.

#### Number of vertices.

If a dataset has few vertices, as it is the case with _Rotterdam_ , then the
indices will not be large integers and this might not be favourable for the
compression. As an experiment, we have created around 100 synthetic CityJSON
datasets containing buildings, and each building is represented as a simple
cube, which is randomly generated. There are no attributes, no semantics, and
no textures/materials. Figure 6(a) shows that, as the CityJSON filesize
increases, the compression factor increases. The smallest file contains only
526 buildings and its compression factor is -2% (thus CityJSONSeq has a larger
filesize than that of CityJSON), while the largest file has $3\,960\,105$
buildings, and a compression factor of more than 12%.

(a)

(b)

Figure 6: Compression factor of CityJSONSeq files for different synthetic
datasets. (a) Based on the number of buildings; the buildings are stored as
simple cuboids that are randomly generated. (b) Based on the percentage of
shared vertices; the same cuboid buildings are used, but we position them
adjacent to each others to create shared vertices.

#### Shared vertices.

The number of shared vertices between different city objects also influences
the compression factor. Shared vertices are those used to represent walls
incident to two adjacent buildings. In CityJSON they are conceptually the same
vertices and each of the surfaces refer to them, but in CityJSONSeq they have
to be listed separately in each of the buildings. It should be said that most
of the datasets have very few vertices that are shared (most have less than
2%, except 2 datasets have around 20%, _Rotterdam_ being one of them). To
understand the correlation between the compression factor and the percentage
of shared vertices in a datasets, we have modified the script to generate
random cuboid buildings: the distribution of the buildings is not random, we
have enforced that several buildings are adjacent to others (so that they
share vertices with other buildings). The relationship between the compression
and the percentage of shared vertices can be seen in Figure 6(b) for around
100 datasets containing exactly $1\,000\,000$ buildings. If the number of
shared vertices is 0% this means that we have $1\,000\,000$ buildings that are
disconnected; in this case we obtain a compression factor of around 8% (as was
the case in Figure 6(a)). If all the buildings are adjacent to another one
(thus nearly 100% of the vertices are shared), then we can see that the
compression factor is about -10% (which means that the size of the CityJSONSeq
file is larger than that of the CityJSON file).

#### Textures.

It should also be noticed that the attributes attached to city objects, as
well as the semantics attached to surfaces, have no influence on the
compression factor since they are local to each city object. However, we can
state that textures have an influence on the compression factor. See for
instance the dataset _Helsinki_ and its counterpart _Helsinki_tex_ (which is
the same the same geometries and attributes, only the textures were removed).
The dataset with textures has a compression of 10% while the one without 28%.
This is explained by the fact that the "textures" property must be used for
each feature, while in a CityJSON object they are all stored at only one
location. Since textures can be used by several features (all the bricks of a
building could use the same one), this means that often the same properties
for textures are copied to several features.

###  5.2 Processing speed comparison

Table 2: Comparison of the processing time and maximum RAM usage for processing CityJSON and CityJSONSeq files. The resident set size (RSS) is used, which is the portion of main memory occupied by the Python script. |  | RAM used (MB) |  | time (s)
---|---|---|---|---
|  | CityJSON | CityJSONSeq |  | CityJSON | CityJSONSeq | diff
3DBAG |  | 76.9 | 16.1 |  | 0.10 | 0.07 | 1.4X
3DBV |  | 4101.8 | 123.8 |  | 10.95 | 3.59 | 3.1X
Helsinki |  | 3743.1 | 15.0 |  | 13.39 | 2.74 | 4.9X
Helsinki_tex |  | 5004.8 | 19.1 |  | 29.60 | 4.72 | 6.3X
Ingolstadt |  | 65.5 | 21.3 |  | 0.08 | 0.06 | 1.3X
Montréal |  | 79.3 | 20.8 |  | 0.11 | 0.07 | 1.6X
NYC |  | 949.5 | 16.0 |  | 1.78 | 0.70 | 2.5X
Railway |  | 69.6 | 29.6 |  | 0.09 | 0.07 | 1.3X
Rotterdam |  | 42.4 | 14.6 |  | 0.04 | 0.04 | 1.0X
Vienna |  | 60.1 | 15.7 |  | 0.06 | 0.05 | 1.2X
Zurich |  | 2793.1 | 16.3 |  | 6.05 | 2.00 | 3.0X

We compare the speed and memory footprint of accessing each city object in a
dataset. This operation is common in applications that manipulate 3D city
models.

When a city model is stored in its entirety in one CityJSON object, we need to
deserialise the whole CityJSON object into memory in order to access the
"transform" and "vertices" properties for instance.

With a CityJSONSeq file, we can read the file line by line, processing and
discarding the city objects one by one (and thus never have in memory more
than the city object itself and the first JSON object in the stream). As shown
in the experiments below, this allows for very efficient operations in terms
of both CPU and memory usage.

We have processed all the datasets from Table 1 with two simple Python scripts
that iterate through the city objects and their geometries, and increment a
global counter for the geometry type (Solid or MultiSurface) and report it at
the end. This is just an example of a simple local operation, any other
operation such as calculating the area of the façades or counting the number
of windows could have been performed. The results for both the maximum memory
footprint and the time used are shown in Table 2. The scripts are available in
the reproducibility repository of the
paper777https://github.com/cityjson/paper˙cjseq.

Notice that the dataset _3DBV_ contains not only buildings but also the
terrain, and a few large areas are stored as a triangulation containing a very
large amount of vertices; this is the reason why the maximum memory use is
larger than for other datasets.

The results in Table 2 indicate that there is a significant benefit to using
CityJSONSeq over CityJSON, at least for operations that do not require
analysing or processing city objects that are close to each other. Operations
like calculating volumes, merging and subsetting files, finding city objects
with specific attributes, etc. will all use significantly less memory and will
be significantly faster. Operations like modifying the CRS or updating the
metadata would not even require to loop through the features, just to alter
the first object in the file. Operations like calculating the surface of
shared walls [Agugiaro et al., 2022] are however not suitable for streams.

##  6 Discussion and future work

While CityJSONSeq was developed mostly for streaming large 3D city datasets,
the fact that it has a much lower memory footprint and that it takes an order
of magnitude less time to process (for some local operations) makes it an
attractive alternative to CityJSON for several use-cases.

It should be noticed that the CityJSON specification does not prescribe the
storage of CityJSONSeq, only the structure of a CityJSONSeq stream. In
practice, CityJSONSeq can be stored in a variety of ways, for instance in a
single file, each feature in a separate file, in a database, etc. The optimal
storage solution depends on the implementing application. As a concrete
example, CityJSONSeq is used by _cjdb_ [Powałka et al., 2024], an
importer/exporter tool that stores one feature per row in PostgresSQL.
Additionally, in order to facilitate pagination, CityJSONSeq is the return
format of the 3DBAG API888https://api.3dbag.nl/, which contains all 10 million
buildings in the Netherlands with detailed roofs [Peters et al., 2022].

From the point-of-view of practitioners, we should stress that CityJSONSeq can
easily be processed with _Unix pipes_ (also called _pipelines_). Pipelines
allow us to chain several processes together, the output of a process becomes
the input of the next one, and so on. Given 2 processes, the 2nd one can
usually start before the 1st one has finished processing all the data. This
means that, in practice, the processing of a dataset can be performed by
writing several programs that perform a few small tasks; this makes the
development and maintenance of code simpler. Moreover, it allows us to write
the code in different languages. The pipelines used for preparing the datasets
used in this paper were actually a mix of Python (the program _cjio_ and
_cjdb_) and Rust (_cjseq_ and _cjval_), and another program written in C++
could easy be added.

Finally, because the structure of CityJSONSeq is nearly the same as that of
CityJSON, in practice adding support for CityJSONSeq requires a minimum amount
of effort since most of the code to parse and/or generate CityJSON objects can
be reused. We have already added support for CityJSONSeq in a few of the open-
source tools999https://www.cityjson.org/software/ and we will continue in the
future.

## References

  * Agugiaro et al. [2022] G. Agugiaro, A. Zwamborn, C. Tigchelaar, E. Matthijssen, C. León-Sánchez, F. van der Molen, and J. Stoter.  On the influence of party walls for urban energy modelling.  _The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences_ , XLVIII-4/W5-2022:9–16, 2022\.
  * Bray [2017] T. Bray.  The javascript object notation (JSON) data interchange format.  Technical Report RFC 8259, Standard from Internet Engineering Task Force (IETF), 2017.
  * Butler et al. [2016] H. Butler, M. Daly, A. Doyle, S. Gillies, T. Schaub, and S. Hagen.  The GeoJSON Format.  Technical Report RFC 7946, Standard from Internet Engineering Task Force (IETF), 2016.
  * Gillies [2017] S. Gillies.  GeoJSON Text Sequences.  Technical Report RFC 8142, Standard from Internet Engineering Task Force (IETF), 2017.
  * Isenburg et al. [2003] M. Isenburg, P. Lindstrom, S. Gumhold, and J. Snoeyink.  Large mesh simplification using processing sequences.  In _IEEE Visualization, 2003. VIS 2003._ , pages 465–472, 2003.  10.1109/VISUAL.2003.1250408.
  * Isenburg et al. [2006] M. Isenburg, Y. Liu, J. R. Shewchuk, J. Snoeyink, and T. Thirion.  Generating raster DEM from mass points via TIN streaming.  In _Geographic Information Science—GIScience 2006_ , volume 4197 of _Lecture Notes in Computer Science_ , pages 186–198, Münster, Germany, 2006.
  * Ledoux et al. [2019] H. Ledoux, K. A. Ohori, K. Kumar, B. Dukai, A. Labetski, and S. Vitalis.  CityJSON: a compact and easy-to-use encoding of the CityGML data model.  _Open Geospatial Data, Software and Standards_ , 4(4), 2019\.  10.1186/s40965-019-0064-0.
  * OGC [2006] OGC.  OpenGIS implementation specification for geographic information—simple feature access.  Open Geospatial Consortium inc., 2006.  Document 06-103r3.
  * OGC [2021a] OGC.  OGC City Geography Markup Language (CityGML) Part 1: Conceptual Model Standard.  Open Geospatial Consortium inc., 2021a.  Document 20-010, version 3.0.0, available at https://docs.ogc.org/is/20-010/20-010.html.
  * OGC [2021b] OGC.  CityJSON Community Standard 1.0.  Open Geospatial Consortium inc., 2021b.  Document 20-072r2, version 1.0.
  * OGC [2023a] OGC.  OGC City Geography Markup Language (CityGML) Part 2: GML Encoding Standard.  Open Geospatial Consortium inc., 2023a.  Document 21-006r2, version 3.0.
  * OGC [2023b] OGC.  CityJSON Community Standard 2.0.  Open Geospatial Consortium inc., 2023b.  Document 20-072r5, version 2.0.
  * Peters et al. [2022] R. Peters, B. Dukai, S. Vitalis, J. van Liempt, and J. Stoter.  Automated 3D reconstruction of LoD2 and LoD1 models for all 10 million buildings of the Netherlands.  _Photogrammetric Engineering and Remote Sensing_ , 88(3), 2022.
  * Powałka et al. [2024] L. Powałka, C. Poon, Y. Xia, S. Meines, L. Yan, Y. Cai, G. Stavropoulou, B. Dukai, and H. Ledoux.  In T. Kolbe, A. Donaubauer, and C. Beil, editors, _Recent Advances in 3D Geoinformation Science (Proceedings of the 18th 3D GeoInfo Conference)_ , pages 781–796. Springer, 2024.  https://doi.org/10.1007/978-3-031-43699-4_47.
  * Praschl and Krauss [2023] C. Praschl and O. Krauss.  Extending 3D geometric file formats for geospatial applications.  _Applied Geomatics_ , 16(1):161–180, 2023.
  * Williams [2015] N. Williams.  JavaScript Object Notation (JSON) Text Sequences.  Technical Report RFC 7464, Standard from Internet Engineering Task Force (IETF), 2015.