Пример #1
0
def get_odho():
    n = 2
    l = 10

    grid_length = 5
    num_grid_points = 1001
    omega = 1

    odho = GeneralOrbitalSystem(
        n,
        ODQD(
            l, grid_length, num_grid_points, potential=ODQD.HOPotential(omega)
        ),
    )

    return odho
Пример #2
0
def get_oddw_smooth():
    n = 2
    l = 10

    grid_length = 5
    num_grid_points = 1001
    a = 5

    oddw_smooth = GeneralOrbitalSystem(
        n,
        ODQD(
            l,
            grid_length,
            num_grid_points,
            potential=ODQD.DWPotentialSmooth(a=a),
        ),
    )

    return oddw_smooth
def test_single_time_evolution_operator():
    n = 4
    l = 10
    dim = 3

    spas = SpatialOrbitalSystem(n, RandomBasisSet(l, dim))
    gos = GeneralOrbitalSystem(n, RandomBasisSet(l, dim))

    assert not spas.has_one_body_time_evolution_operator
    assert not gos.has_one_body_time_evolution_operator
    assert not spas.has_two_body_time_evolution_operator
    assert not gos.has_two_body_time_evolution_operator

    np.testing.assert_allclose(spas.h_t(10), spas.h)
    np.testing.assert_allclose(spas.u_t(10), spas.u)
    np.testing.assert_allclose(gos.h_t(10), gos.h)
    np.testing.assert_allclose(gos.u_t(10), gos.u)

    spas.set_time_evolution_operator(CustomOneBodyOperator(2, spas.h),
                                     add_h_0=False)
    gos.set_time_evolution_operator(CustomOneBodyOperator(3, gos.h),
                                    add_u_0=False)

    assert spas.has_one_body_time_evolution_operator
    assert gos.has_one_body_time_evolution_operator
    assert not spas.has_two_body_time_evolution_operator
    assert not gos.has_two_body_time_evolution_operator

    np.testing.assert_allclose(
        spas.h_t(0),
        spas.h * 2,
    )
    np.testing.assert_allclose(spas.u_t(0), spas.u)

    np.testing.assert_allclose(
        gos.h_t(0),
        gos.h + gos.h * 3,
    )
    np.testing.assert_allclose(gos.u_t(0), np.zeros_like(gos.u))
Пример #4
0
def get_oddw():
    n = 2
    l = 10

    grid_length = 6
    num_grid_points = 1001

    omega = 1
    length_of_dw = 5

    oddw = GeneralOrbitalSystem(
        n,
        ODQD(
            l,
            grid_length,
            num_grid_points,
            potential=ODQD.DWPotential(omega, length_of_dw),
        ),
    )

    return oddw
def test_multiple_time_evolution_operators():
    n = 4
    l = 10
    dim = 3

    spas = SpatialOrbitalSystem(n, RandomBasisSet(l, dim))
    gos = GeneralOrbitalSystem(n, RandomBasisSet(l, dim))

    assert not spas.has_one_body_time_evolution_operator
    assert not gos.has_one_body_time_evolution_operator
    assert not spas.has_two_body_time_evolution_operator
    assert not gos.has_two_body_time_evolution_operator

    spas.set_time_evolution_operator(
        [
            CustomOneBodyOperator(2, spas.h),
            CustomOneBodyOperator(3, spas.s),
            AdiabaticSwitching(2),
        ],
        add_u_0=False,
    )

    gos.set_time_evolution_operator(
        (
            CustomOneBodyOperator(1, gos.h),
            CustomOneBodyOperator(3, gos.s),
            CustomOneBodyOperator(-2, gos.position[0]),
        ),
        add_h_0=False,
    )

    assert spas.has_one_body_time_evolution_operator
    assert gos.has_one_body_time_evolution_operator
    assert spas.has_two_body_time_evolution_operator
    assert not gos.has_two_body_time_evolution_operator

    np.testing.assert_allclose(
        spas.h_t(0),
        spas.h + spas.h * 2 + spas.s * 3,
    )
    np.testing.assert_allclose(spas.u_t(0), 2 * spas.u)

    np.testing.assert_allclose(
        gos.h_t(0),
        gos.h + gos.s * 3 - gos.position[0] * 2,
    )
    np.testing.assert_allclose(gos.u_t(0), gos.u)
Пример #6
0
def get_odgauss():
    n = 2
    l = 10

    grid_length = 20
    num_grid_points = 1001

    weight = 1
    center = 0
    deviation = 2.5

    odgauss = GeneralOrbitalSystem(
        n,
        ODQD(
            l,
            grid_length,
            num_grid_points,
            potential=ODQD.GaussianPotential(weight, center, deviation, np=np),
        ),
    )

    return odgauss
Пример #7
0
def get_tddw():
    n = 2
    l = 10
    axis = 0

    radius = 8
    num_grid_points = 201
    barrier_strength = 3
    omega = 0.8

    tddw = GeneralOrbitalSystem(
        n,
        TwoDimensionalDoubleWell(
            l,
            radius,
            num_grid_points,
            barrier_strength=barrier_strength,
            omega=omega,
            axis=axis,
        ),
    )

    return tddw
def test_single_dipole_time_evolution_operator():
    n = 4
    l = 10
    dim = 3

    omega = 0.25

    spas = SpatialOrbitalSystem(n, RandomBasisSet(l, dim))
    gos = GeneralOrbitalSystem(n, RandomBasisSet(l, dim))

    field = lambda t: np.sin(omega * 2)
    polarization = np.zeros(dim)
    polarization[0] = 1

    spas.set_time_evolution_operator(
        DipoleFieldInteraction(
            field,
            polarization,
        ))
    gos.set_time_evolution_operator(
        DipoleFieldInteraction(
            field,
            polarization,
        ))

    assert spas.has_one_body_time_evolution_operator
    assert gos.has_one_body_time_evolution_operator
    assert not spas.has_two_body_time_evolution_operator
    assert not gos.has_two_body_time_evolution_operator

    for t in [0, 0.1, 0.5, 1.3]:
        np.testing.assert_allclose(
            spas.h_t(t),
            spas.h - field(t) * spas.dipole_moment[0],
        )
        np.testing.assert_allclose(
            gos.h_t(t),
            gos.h - field(t) * gos.dipole_moment[0],
        )

        np.testing.assert_allclose(spas.u_t(t), spas.u)
        np.testing.assert_allclose(gos.u_t(t), gos.u)