|
1 | 1 | using Test |
2 | 2 | using LinearAlgebra |
3 | 3 | using QuantumControl.Controls: get_control_deriv, get_control_derivs |
4 | | -using QuantumPropagators.Generators |
5 | | -using QuantumPropagators.Controls |
6 | 4 | using QuantumPropagators: Generator, Operator |
| 5 | +using QuantumPropagators.Controls: evaluate, get_controls |
7 | 6 | using QuantumControlTestUtils.RandomObjects: random_matrix, random_state_vector |
8 | 7 | using QuantumControl.Interfaces: check_generator, check_amplitude |
9 | | -using QuantumPropagators.Amplitudes: LockedAmplitude, ShapedAmplitude |
| 8 | +using QuantumPropagators.Amplitudes: LockedAmplitude, ShapedAmplitude, GuidedAmplitude |
10 | 9 | import QuantumPropagators |
11 | 10 | import QuantumControl |
12 | 11 |
|
|
166 | 165 | @test get_control_deriv(ampl2, control2) == LockedAmplitude(ampl2.shape) |
167 | 166 |
|
168 | 167 | end |
| 168 | + |
| 169 | + |
| 170 | +@testset "GuidedAmplitude get_control_derivs" begin |
| 171 | + |
| 172 | + shape(t) = 1.0 |
| 173 | + guide(t) = 0.1 |
| 174 | + control(t) = 0.5 |
| 175 | + tlist = [0.0, 0.5, 1.0] |
| 176 | + |
| 177 | + ampl1 = GuidedAmplitude(control; shape, guide) |
| 178 | + ampl2 = GuidedAmplitude(control, tlist; shape, guide) |
| 179 | + |
| 180 | + @test get_control_deriv(ampl1, t -> 0.0) == 0.0 |
| 181 | + @test get_control_deriv(ampl1, shape) == 0.0 |
| 182 | + @test get_control_deriv(ampl1, control) == LockedAmplitude(shape) |
| 183 | + |
| 184 | + @test get_control_deriv(ampl2, t -> 0.0) == 0.0 |
| 185 | + @test get_control_deriv(ampl2, shape) == 0.0 |
| 186 | + control2 = get_controls(ampl2)[1] |
| 187 | + @test control2 ≢ control # should have been discretized |
| 188 | + @test ampl2.shape ≢ shape # should have been discretized |
| 189 | + @test control2 isa Vector{Float64} |
| 190 | + @test ampl2.shape isa Vector{Float64} |
| 191 | + @test get_control_deriv(ampl2, control2) == LockedAmplitude(ampl2.shape) |
| 192 | + |
| 193 | +end |
0 commit comments