Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions quam_builder/architecture/neutral_atoms/components/slm.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
from quam.core import quam_dataclass
from quam.components import SingleChannel, DigitalOutputChannel
from quam_builder.architecture.neutral_atoms.components.tweezer_driver import TweezerDriver
from quam.components import QuantumComponent
from dataclasses import field

@quam_dataclass
class SLM(TweezerDriver):
channel: DigitalOutputChannel
channel_name: str # Name of the registered SingleChannel (avoids parent conflict)
frequency_to_move: float # Frequency shift to move the tweezer position
pattern_loaded: bool = field(default=True, init=False) # preloaded by default
pattern_loaded: bool = field(default=True, init=False) # preloaded by default

@property
def name(self) -> str:
return self.id


@property
def channel(self):
"""Resolve the channel by name from the QPU."""
return self.parent.parent.get_channel(self.channel_name)

@QuantumComponent.register_macro
def on(self):
"""Trigger the SLM to display the preloaded phase mask."""
self.channel.current_voltage = 1.0
self.parent.parent.align(elements=[self]) # ensure timing alignment with other channels as the SLM turns on
"""Trigger the SLM by playing a pulse with digital marker ON."""
self.channel.play("slm_on")
self.parent.parent.align(elements=[self])

@QuantumComponent.register_macro
def off(self):
"""Turn off the SLM."""
self.channel.current_voltage = 0.0
"""Turn off the SLM by playing a pulse without digital marker."""
self.channel.play("slm_off")
53 changes: 36 additions & 17 deletions tests/neutral_atoms/GHZ/ghz.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import matplotlib
matplotlib.use("TkAgg")
from qm import QuantumMachinesManager, SimulationConfig
from quam_builder.architecture.neutral_atoms.base_quam_na import BaseQuamNA
from quam_builder.architecture.neutral_atoms.atom import Atom
Expand Down Expand Up @@ -42,19 +44,27 @@ def load_atoms():
def init_qpu():
qpu = BaseQuamNA()

aod_channel_x = SingleChannel(opx_output=("con1",1, 1), id="ch1")
aod_channel_y = SingleChannel(opx_output=("con1",1, 2), id="ch2")
# LF-FEMs are in slots 5 and 6 on cluster CS_4
aod_channel_x = SingleChannel(opx_output=("con1", 5, 1), id="ch1")
aod_channel_y = SingleChannel(opx_output=("con1", 5, 2), id="ch2")

SLM_channel = DigitalOutputChannel(opx_output=("con1",1, 3))
hamammatsu_channel = SingleChannel(opx_output=("con1",1, 4) ,id="ch4")

drive_channel = SingleChannel(opx_output=("con1",1, 5), id="ch5")
readout_channel = SingleChannel(opx_output=("con1",1, 6), id="ch6")
prepare_channel = SingleChannel(opx_output=("con1",1, 7), id="ch7")
entangle_channel = SingleChannel(opx_output=("con1",1, 8), id="ch8")

channels = [aod_channel_x, aod_channel_y, drive_channel, readout_channel, prepare_channel, entangle_channel]
digital_channels = [SLM_channel, hamammatsu_channel]
SLM_digital = DigitalOutputChannel(opx_output=("con1", 5, 1), delay=0, buffer=0)
SLM_channel = SingleChannel(
opx_output=("con1", 5, 3), id="SLM532",
digital_outputs={"do1": SLM_digital}
)
hamammatsu_channel = SingleChannel(opx_output=("con1", 5, 4), id="ch4")

drive_channel = SingleChannel(opx_output=("con1", 5, 5), id="ch5")
readout_channel = SingleChannel(opx_output=("con1", 5, 6), id="ch6")
prepare_channel = SingleChannel(opx_output=("con1", 5, 7), id="ch7")
entangle_channel = SingleChannel(opx_output=("con1", 5, 8), id="ch8")

# SLM pulses: on has digital marker high, off has no digital marker
SLM_channel.operations["slm_on"] = pulses.SquarePulse(amplitude=0.0, length=100, digital_marker="ON")
SLM_channel.operations["slm_off"] = pulses.SquarePulse(amplitude=0.0, length=100)

channels = [aod_channel_x, aod_channel_y, SLM_channel, drive_channel, readout_channel, prepare_channel, entangle_channel]

# Create the square pulse
for channel in channels:
Expand All @@ -65,7 +75,7 @@ def init_qpu():
for channel in channels:
channel.operations["move_pulse"] = pulses.SquarePulse(amplitude=0.25, length=1000)
qpu.register_channel(channel)

# -- set QPU default parameters --
qpu.tweezer_depth = 10
qpu.scale = 1.0
Expand All @@ -81,7 +91,7 @@ def init_qpu():

# -- Driver -- #
aod = AOD(id="AOD532", channels=(aod_channel_x, aod_channel_y), frequency_to_move=1 , f_min=-70.0 * 1e6, f_max=70.0 * 1e6, max_total_power=1.0)
slm = SLM(id="SLM532", channel=SLM_channel, frequency_to_move=1)
slm = SLM(id="SLM532", channel_name="SLM532", frequency_to_move=1)
for driver in [aod, slm]:
qpu.register_driver(driver)

Expand Down Expand Up @@ -216,10 +226,10 @@ def main():
prog = ghz_4(qpu)
config = qpu.generate_config()

current_folder = Path(__file__).resolve().parent
serialize_qua_program(prog, qpu, path=current_folder)
# current_folder = Path(__file__).resolve().parent
# serialize_qua_program(prog, qpu, path=current_folder)

qmm = QuantumMachinesManager(host="172.16.33.114", cluster_name="CS_4") #Serialize
qmm = QuantumMachinesManager(host="172.16.33.114", cluster_name="CS_4") #Serialize
qm = qmm.open_qm(config)

qmm.clear_all_job_results()
Expand All @@ -228,5 +238,14 @@ def main():
simulation_config = SimulationConfig(duration=2000)
job = qmm.simulate(config, prog, simulation_config)

# Plot simulation output
import matplotlib.pyplot as plt


samples = job.get_simulated_samples()
samples.con1.plot()
plt.show()


if __name__ == "__main__":
main()