Visualization
AtomTwin provides animation support for 2D atomic trajectories via a GLMakie extension. The extension is loaded automatically when GLMakie is available in the environment.
Setup
Install GLMakie and load it before using AtomTwin:
# In your Julia environment:
# pkg> add GLMakie
using GLMakie
using AtomTwin
using AtomTwin.Visualization: animateAnimation
animate reads position data recorded by motion detectors and produces an interactive 2D scatter animation showing how atoms move through the tweezer array over time. It can also save a GIF.
The typical workflow is:
- Add
MotionDetectorSpecentries to your system before running. - Call
playto get the output. - Call
animateon the output, specifying display options per detector group.
# Add a motion detector for a group of atoms
add_detector!(system, MotionDetectorSpec(tweezers; name = "row1"))
out = play(system, seq; initial_state = initial_state)
# Animate interactively
animate(out;
options = Dict("row1" => (color = :blue, markersize = 10)),
limits = ((-50, 50), (-20, 20)), # μm
unit = 1e-6, # convert m → μm
sleep_time = 0.001,
)
# Or save to a GIF
animate(out;
options = Dict("row1" => (color = :blue,)),
gifname = "sorting.gif",
framerate = 30,
)See the Atom sorting example for a complete worked example including motion detectors and visualization.
AtomTwin.Visualization.animate — Function
animate(args...; kwargs...)Animate atomic configurations.
This method requires GLMakie.