initial_0 = target_1 = qt.basis(3, 0) # |0>
initial_1 = target_0 = qt.basis(3, 1) # |1>
tlist = np.linspace(0, 0.5, 100)
init_pulse = [np.sin(t) for t in tlist]
control = qt.Qobj([[0, 1, 0], [1, 0, 1], [0, 1, 0]])
drift = qt.qeye(3)
H = [drift, [control, init_pulse]]
objectives = [ # weights are optional
qoc.Objective(initial_0, H, target_0, weight=0.5),
qoc.Objective(initial_1, H, target_1, weight=0.5),
]
result = qoc.optimize_pulses(
objectives,
control_parameters={
"ctrl": {
"guess": init_pulse,
"bounds": [-10, 10],
}
},
tlist=tlist,
algorithm_kwargs={
"alg": "GRAPE",
"fid_err_targ": 0.1,
}
)