3D plot of the creation of a pulse of light

Manipulating the photon number: simulating a controlled interaction of light and matter

“Jordi Blasco and the NeSI Computational Science team enabled us to achieve over 600 times improvement in the speed of the simulation workflow.”

Victor Canela is doctoral candidate in physics at the University of Auckland and studies a quantum optics system called a micromaser or one-atom maser. Together with his supervisor, Prof. Howard Carmichael, they simulate a microwave cavity through which atoms transit and interact with the electromagnetic field inside.

The atoms are approximated as two level systems with a lower and upper energy state. As the atom enters the cavity, it will interact with the field exchanging energy. Victor can model this exchange of energy packets between the atom and the field as creation or destruction of photons. For example, when the atom is in the upper energy state, it can transition to the lower state by emitting a photon.

The current project focuses on the number of photons in the cavity, and how this evolves with changes to the atomic flux. In particular, the researchers wanted to produce sub-Poissonian fields with large photon numbers or states of the field with both high and a definite number of photons.

Numerically, the problem is no more complicated than solving a set of linear ordinary differential equations (ODEs). How many ODEs are needed depends on the number of atoms inside the cavity, and this fluctuates, following a random process, between 0 and 20. With n atoms present, 2n ODEs must be solved at each time-step. In order to achieve the steady state solution a big number of time-steps in the order of 1010 must be completed to obtain sufficient averages of photon numbers.

Initially, the simulation was written in Python using Numpy and Scipy but later it was translated to FORTRAN 95 in order to achieve better performance. The simulation ran successfully in the NeSI Pan cluster but reliability and speed was an issue. Jordi Blasco, a member of the NeSI Computational Science team, recommended that the compilers be switched from GCC to the Intel compilers and add guided auto-vectorisation flags. Without touching the code, the simulation then ran close to three times as fast.

In addition, Jordi proposed transforming the problem into a highly decoupled problem with parameter switching workflow. In less than one hour of working with the code and after changing eight lines of FORTRAN, the application was able to run several independent trajectories at once. By that time, each run took around two or three weeks of serial CPU time, and because of that, the job was suspended quite often. After integrating Slurm job array into the new workflow, more than 100 trajectories could be run which finally provided a major impact in the wall-time by decreasing the whole simulation runtime by 100 times.


Fig 1. PHOTON number (blue) and Mandel Q (orange) response to atomic flux.
Fig 1. PHOTON number (blue) and Mandel Q (orange) response to atomic flux.

The existence of “trapping states” (dashed lines) of photons produce negative values of Mandel Q for particular atomic fluxes, resulting in sub-Poissonian distributions. In contrast, as the photon number lies in between trapping states (see Fig 2) the photon number distribution has multiple peaks.

Fig 2. Sample trajectory (top), with its photon distribution (bottom) for an atomic flux of N=0.13 (see Fig 1).
Fig 2. Sample trajectory (top), with its photon distribution (bottom) for an atomic flux of N=0.13 (see Fig 1).

The photon number switches between regions close to two neighbouring trapping states; changing the atomic flux we can target one of them and determine more accurately the photon number.

“We continued to work closely with Jordi, and started optimising parts of the code with the help of Intel’s loop profiler and Intel’s VTune Amplifier 2015,” says Victor Canela.

“In particular, with the second one, we were able to pinpoint the most visited loops and identify bottlenecks in the code. Most corrections were minor tweaks, but had a big impact overall because of the auto-vectorisation capabilities of the code and the huge amount of time-steps involved.”

After several meetings with Jordi, the overall improvement in speed in the simulation workflow is now over 600 times. The speed gained, as well as the increased reliability in the runs, has enabled the researchers to probe regions of higher atomic fluxes and develop various mechanisms of active control to manipulate the photon number and produce sub-Poissonian states of the electromagnetic field with more than 50 photons. They are also able to access parameter regions that previously could not be simulated, in particular lowering the decay rate of the cavity to increase the mean number of photons and increasing the atomic flux.

With the optimised code, the researchers can now also include more sources of noise in the system such as spontaneous emission of the atom or a variable coupling between the atom and field, making the simulation more robust.

Next Case Study

Dr Niki Osborne in the Bloodstain Pattern Analysis lab at the Institute of Environmental Science and Research.

Investigating the reliability of bloodstain pattern analysis

“Without an organisation like NeSI, and the services that they provide, it is unlikely that we would have been able to advance the research methodology to a Bayesian framework."