示例#1
0
N = 1000
# x domain
x_min = -50
x_max = 50
# starting point
t = 0
t_max = 6
# create list of all x points
x = np.linspace(x_min, x_max, N, endpoint=True)
# time step
dt = 0.1
# calculate initial state
# current_state = psi(x)

# create the Stepper which propagates times
stepper = Stepper(None, t, x, V)
stepper.t_max = t_max
time_shift = t_max / 2
energys, eigenstates = stepper.get_stationary_solutions(k=250)
iterations = 1000
diff = np.zeros((iterations, 5))

for i in range(iterations):
    parameters = np.random.rand(len(max_parameters)) * max_parameters
    if i == 0:
        parameters = np.array([0.6591, 0.6819, 0.7859, 4.4431])

    # frequencies = [(1, parameters[2]), (parameters[3], parameters[4])]
    # stepper.set_electric_field(parameters[0], time_shift, parameters[1], frequencies)
    stepper.set_electric_field2(parameters[0],
                                [(1, parameters[1]),
示例#2
0
goal = ti.var(dt=ti.f64, shape=N, needs_grad=True)
occupation = ti.var(dt=ti.f64, shape=(), needs_grad=True)
projection = ti.Vector(2, dt=ti.f64, shape=(), needs_grad=True)

left_main_diag = ti.Vector(2, dt=ti.f64, shape=N, needs_grad=True)
left_upper_diag = ti.Vector(2, dt=ti.f64, shape=N - 1, needs_grad=True)
left_lower_diag = ti.Vector(2, dt=ti.f64, shape=N - 1, needs_grad=True)

right_main_diag = ti.Vector(2, dt=ti.f64, shape=N, needs_grad=True)
right_upper_diag = ti.Vector(2, dt=ti.f64, shape=N - 1, needs_grad=True)
right_lower_diag = ti.Vector(2, dt=ti.f64, shape=N - 1, needs_grad=True)
right_side = ti.Vector(2, dt=ti.f64, shape=N, needs_grad=True)

current = ti.Vector(2, dt=ti.f64, shape=N, needs_grad=True)

stepper = Stepper(None, t, x, V)
energys, eigenstates = stepper.get_stationary_solutions(k=250)

parameters.from_numpy(p)
space.from_numpy(x)
initial.from_numpy(np.real(eigenstates[0]))
goal.from_numpy(np.real(eigenstates[1]))

harmonic_pot()
# init()
# while t < t_max:
#     step()
#     t += dt
# get_occupation()

# testing grad
示例#3
0
N = 1000
# x domain
x_min = -50
x_max = 50
# starting point
t = 0
t_max = 6
# create list of all x points
x = np.linspace(x_min, x_max, N, endpoint=True)
# time step
dt = 0.1
# calculate initial state
# current_state = psi(x)

# create the Stepper which propagates times
stepper = Stepper(None, t, x, V)
stepper.t_max = t_max
energys, eigenstates = stepper.get_stationary_solutions(k=250)

target_freq = 4.


def spectrum(parameters):
    time_shift = t_max / 2

    stepper.set_time(0)
    stepper.set_state(eigenstates[0], normalzie=False)

    frequencies = [(1, parameters[2]), (parameters[3], parameters[4])]
    stepper.set_electric_field(parameters[0], time_shift, parameters[1],
                               frequencies)
示例#4
0
simulation = jit(simulate, static_argnums=6)

N = 1000
x_min = -50
x_max = 50
space = np.linspace(x_min, x_max, N, endpoint=True, dtype=np.float64)
dx = 0.1
dx2 = dx ** 2

# parameters = np.array([2.21, 1.59, 1.60, 3.14, 2.15], dtype=np.float64)
parameters = np.array([10., 1., 5., 1., 5.], dtype=np.float64)
t = 0.
t_h = 3.0
dt = 0.1

stepper = Stepper(None, 0, onp.array(space), harmonic_pot_np)
energys, eigenstates = stepper.get_stationary_solutions(k=250)


state = np.array(eigenstates[0], dtype='complex128')

target_freq = 1.

N_step = int(2 * t_h / dt)

freqs = np.fft.fftshift(np.fft.fftfreq(N_step, dt / (2 * np.pi)))
target_index = 0
for i in range(0, N_step):
    if target_freq < freqs[i]:
        target_index = i - 1
        break
示例#5
0
    N = 1000
    # x domain
    x_min = -50
    x_max = 50
    # starting point
    t = 0
    t_max = 6
    # create list of all x points
    x = np.linspace(x_min, x_max, N, endpoint=True)
    # time step
    dt = 0.1
    # calculate initial state
    # current_state = psi(x)

    # create the Stepper which propagates times
    stepper = Stepper(None, t, x, V)
    stepper.t_max = t_max

    energys, eigenstates = stepper.get_stationary_solutions(k=250)
    targets = []
    goal = [i - 1 for i in max_indices]

    try:
        while indices[0] < max_indices[0]:
            print(f'Current indicies = {indices}\n End = {goal}')
            stepper.set_time(0)
            stepper.set_state(eigenstates[0], normalzie=False)
            stepper.set_electric_field(amplitudes[indices[0]], t_max / 2, time_widths[indices[1]],
                                       [(1, freq1[indices[2]]),
                                        (amp_freq2[indices[3]], freq2[indices[4]])])
            stepper.step_to(t_max, dt)