def make_eta_plot(etas):
    number_of_periods = 10

    test_width = 1 * bohr_radius
    test_charge = 1 * electron_charge
    test_mass = 1 * electron_mass
    # potential_depth = 36.831335 * eV

    prefactor = ide.gaussian_prefactor_LEN(test_width, test_charge)
    tau_alpha = ide.gaussian_tau_alpha_LEN(test_width, test_mass)
    kernel = functools.partial(ide.gaussian_kernel_LEN, tau_alpha=tau_alpha)
    omega_alpha = 1 / (2 * tau_alpha)

    periods = np.linspace(0, 3, 500) * tau_alpha
    periods = periods[1:]

    def curve(periods, eta):
        results = []
        for period in periods:
            kicks = make_sine_wave_kicks(number_of_periods, period, eta)

            results.append(
                dpm.recursive_kicks(
                    kicks,
                    abs_prefactor=np.abs(prefactor),
                    kernel_func=kernel,
                    bound_state_frequency=omega_alpha,
                )[-1])

        return np.abs(results)**2

    si.vis.xy_plot(
        f"bound_state_amplitude_vs_sine_period__eta__{etas}",
        periods,
        *[curve(periods, eta) for eta in etas],
        line_labels=[
            fr"$\eta = {eta / time_field_unit:3f}$ a.u." for eta in etas
        ],
        x_label=r"Sine Wave Period $T$ ($ \tau_{\alpha} $)",
        x_unit=tau_alpha,
        y_label=r"$\left|\left\langle a | a \right\rangle\right|^2$",
        # vlines = [tau_alpha / 2, tau_alpha], vline_kwargs = [{'linestyle': ':', 'color': 'black'}, {'linestyle': ':', 'color': 'black'}],
        y_log_axis=True,
        y_log_pad=1,
        legend_kwargs={"loc": "upper right"},
        # y_lower_limit = 1e-9, y_upper_limit = 1,
        **PLOT_KWARGS,
    )
        return sim


if __name__ == "__main__":
    with logman as logger:
        td = np.linspace(0, 1000 * asec, 1000)

        test_mass = 1 * electron_mass_reduced
        test_charge = 1 * electron_charge
        test_width = 1 * bohr_radius

        hyd_kern_prefactor = 128 * (bohr_radius**7) / (3 * (pi**2))
        gau_kern_prefactor = np.sqrt(pi) * (test_width**2)

        kernel_gaussian = gau_kern_prefactor * ide.gaussian_kernel_LEN(
            td, tau_alpha=ide.gaussian_tau_alpha_LEN(test_width, test_mass))
        kernel_hydrogen = ide.hydrogen_kernel_LEN(
            td, kernel_prefactor=ide.hydrogen_kernel_prefactor_LEN())

        si.vis.xy_plot(
            "kernel_comparison",
            td,
            np.abs(kernel_gaussian),
            np.real(kernel_gaussian),
            np.imag(kernel_gaussian),
            np.abs(kernel_hydrogen),
            np.real(kernel_hydrogen),
            np.imag(kernel_hydrogen),
            line_labels=[
                r"Abs Gaussian",
                r"Re Gaussian",
             ElectricPotentialPlotAxis(show_vector_potential=False),
             axman_lower_right=animation.animators.
             WavefunctionStackplotAxis(
                 states=[variational_ground_state]),
             fig_dpi_scale=1,
             target_dir=OUT_DIR,
         )
     ],
     **shared_kwargs,
 )
 len_spec = ide.IntegroDifferentialEquationSpecification(
     "ide_len",
     evolution_gauge="LEN",
     kernel=ide.gaussian_kernel_LEN,
     kernel_kwargs={
         "tau_alpha": ide.gaussian_tau_alpha_LEN(test_width, test_mass)
     },
     integral_prefactor=ide.gaussian_prefactor_LEN(
         test_width, test_charge),
     **shared_kwargs,
     **ide_shared_kwargs,
 )
 vel_spec = ide.IntegroDifferentialEquationSpecification(
     "ide_vel",
     evolution_gauge="VEL",
     kernel=ide.gaussian_kernel_VEL,
     kernel_kwargs={
         "tau_alpha": ide.gaussian_tau_alpha_VEL(test_width, test_mass),
         "width": test_width,
     },
     integral_prefactor=ide.gaussian_prefactor_VEL(
def make_eta_movie():
    length = 30
    etas = np.linspace(0.1, 1, 30 * length) * time_field_unit

    number_of_periods = 10

    test_width = 1 * bohr_radius
    test_charge = 1 * electron_charge
    test_mass = 1 * electron_mass
    # potential_depth = 36.831335 * eV

    prefactor = ide.gaussian_prefactor_LEN(test_width, test_charge)
    tau_alpha = ide.gaussian_tau_alpha_LEN(test_width, test_mass)
    kernel = functools.partial(ide.gaussian_kernel_LEN, tau_alpha=tau_alpha)
    omega_alpha = 1 / (2 * tau_alpha)

    periods = np.linspace(0, 10, 500) * tau_alpha
    periods = periods[1:]

    def curve(periods, eta):
        results = []
        for period in periods:
            kicks = make_sine_wave_kicks(number_of_periods, period, eta)

            results.append(
                dpm.recursive_kicks(
                    kicks,
                    abs_prefactor=np.abs(prefactor),
                    kernel_func=kernel,
                    bound_state_frequency=omega_alpha,
                )[-1])

        return np.abs(results)**2

    si.vis.xyt_plot(
        f"bound_state_amplitude_vs_sine_period__eta_scan",
        periods,
        etas,
        curve,
        x_label=r"Sine Wave Period $T$ ($ \tau_{\alpha} $)",
        x_unit=tau_alpha,
        y_label="Bound State Amplitude",
        t_fmt_string=r"$\eta = {} \; \mathrm{{a.u.}}$",
        t_unit=dpm.time_field_unit,
        vlines=[tau_alpha / 2, tau_alpha],
        vline_kwargs=[
            {
                "linestyle": ":",
                "color": "black"
            },
            {
                "linestyle": ":",
                "color": "black"
            },
        ],
        y_log_axis=True,
        y_log_pad=1,
        y_lower_limit=1e-9,
        y_upper_limit=1,
        length=length,
        **PLOT_KWARGS,
    )
Esempio n. 5
0
def HCC_kernel_SINE(td, efield_0, omega):
    H_kernel = ide.hydrogen_kernel_LEN(td)

    pre = (electron_charge**2) / (2 * electron_mass * hbar)
    first = ((efield_0 / omega)**2) * td
    second = -((efield_0**2) / (omega**3)) * np.sin(omega * td)

    extra = np.exp(-1j * pre * (first + second))

    return H_kernel * extra


if __name__ == "__main__":
    with LOGMAN as logger:
        omega_b = ion.HydrogenBoundState(1, 0).energy / hbar
        tau_alpha = ide.gaussian_tau_alpha_LEN(bohr_radius, electron_mass)
        # print(tau_alpha / asec)
        # print(tau_alpha / atomic_time)
        G_kernel = functools.partial(
            ide.gaussian_kernel_LEN,
            tau_alpha=ide.gaussian_tau_alpha_LEN(bohr_radius, electron_mass),
        )
        #
        # k_integral = si.math.complex_quad(kernel, 0, np.inf)[0]
        # # k_integral = si.math.complex_quadrature(kernel, 0, 1000 * fsec)[0]
        # print(k_integral)
        # print(k_integral / tau_alpha)
        #
        # print(kernel(0))
        # print(kernel(1000 * fsec))
        #
Esempio n. 6
0
    return np.abs(2 * times[np.argmax(np.abs(field))])


if __name__ == "__main__":
    with logman as logger:
        p = ion.potentials.SincPulse(pulse_width=200 * asec, phase=pi / 2)
        times = np.linspace(-100 * asec, 100 * asec, 1000)
        si.vis.xy_plot(
            "test",
            times,
            p.get_electric_field_amplitude(times),
            x_unit="asec",
            **PLOT_KWARGS,
        )

        tau_alpha = ide.gaussian_tau_alpha_LEN(test_width=1 * bohr_radius,
                                               test_mass=electron_mass)
        dt = np.linspace(0, 3 * tau_alpha, 1000)
        k = ide.gaussian_kernel_LEN(time_difference=dt, tau_alpha=tau_alpha)

        si.vis.xy_plot(
            "kernel",
            dt,
            np.abs(k),
            np.real(k),
            np.imag(k),
            x_unit="asec",
            **PLOT_KWARGS,
        )
        imag_min_t = dt[np.argmin(np.imag(k))]
        print(tau_alpha / asec)
        print(imag_min_t / asec)
Esempio n. 7
0
def compare_cosine_and_sine(cosine_product, sine_product):
    test_width = bohr_radius
    test_mass = electron_mass
    test_charge = electron_charge
    # efield_tau_product = 1200 * atomic_electric_field * atomic_time
    # efield = .11 * atomic_electric_field
    # stronger_efield = 1.25 * efield

    # cosine_product = 1 * atomic_electric_field * 10 * asec
    # sine_product = 1.25 * atomic_electric_field * 10 * asec

    # classical_orbit_time = twopi * bohr_radius / (alpha * c)
    # print('orbit time', classical_orbit_time / asec:3f)

    tau_alpha = ide.gaussian_tau_alpha_LEN(test_width, test_mass)
    kernel = functools.partial(ide.gaussian_kernel_LEN, tau_alpha=tau_alpha)

    b_sine = np.sqrt(pi) * ((test_width * test_charge * sine_product / hbar) ** 2)
    b_cosine = np.sqrt(pi) * ((test_width * test_charge * cosine_product / hbar) ** 2)

    # print(b_sine, b_cosine)

    pulse_delays = np.linspace(0, 500 * asec, 1e3)
    double_kick = functools.partial(
        a_alpha, b=b_sine, tau_alpha=tau_alpha, kernel_func=kernel
    )

    ex = np.exp(-1j * pulse_delays / tau_alpha)
    kern = kernel(2 * pulse_delays)
    si.vis.xy_plot(
        "inteference",
        pulse_delays,
        np.real(ex),
        np.imag(ex),
        np.real(kern),
        np.imag(kern),
        2 * np.real(ex + kern),
        line_labels=[
            r"exp real",
            r"exp imag",
            r"ker real",
            r"ker imag",
            r"2 * real(exp + ker)",
        ],
        line_kwargs=[
            {"color": "C0", "linestyle": "-"},
            {"color": "C0", "linestyle": "--"},
            {"color": "C1", "linestyle": "-"},
            {"color": "C1", "linestyle": "--"},
            {"color": "C2", "linestyle": "-"},
        ],
        legend_on_right=True,
        x_label="Half Pulse Delay",
        x_unit="asec",
        **PLOT_KWARGS,
    )

    si.vis.xy_plot(
        f"double_kick__cos={cosine_product / time_field_unit:3f}__sin={sine_product / time_field_unit:3f}",
        2 * pulse_delays,
        double_kick(pulse_delays),
        np.ones_like(pulse_delays) * t1(b_sine),
        t2(pulse_delays, b_sine, kernel),
        t3(pulse_delays, b_sine, kernel, tau_alpha),
        np.ones_like(pulse_delays) * ((1 - b_cosine) ** 2),
        line_labels=[
            r"Double Kick",
            r"Isolated Pulses",
            r"First pulse seen from second",
            r"Interference",
            r"Single Strong Kick",
        ],
        legend_on_right=True,
        x_label="Pulse Delay",
        x_unit="asec",
        vlines=[tau_alpha],
        vline_kwargs=[{"linestyle": ":"}],
        # x_extra_ticks = [tau_alpha, classical_orbit_time],
        # x_extra_tick_labels = [r'$ \tau_{\alpha} $', r'$ \tau_{\mathrm{orb}} $'],
        **PLOT_KWARGS,
    )