示例#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
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