示例#1
0
def test_divergence_1():
    config = {
        'dimH':    13,
        'EC':      1,
        'Omega':   3,
        'y_0':     0.02,
        't_bath':  0.0,
        'tr':      (0, 20, 0.001),
        't_rho0':  [0],
    }

    pf  = 1.0 / config['EC'] * config['Omega'] ** 2
    Oh0 = 0.5 * config['EC'] * Odn2(config['dimH'], qo.QO.T_COMPLEX) \
        - pf * Ocos(config['dimH'], qo.QO.T_COMPLEX)
    rs  = qo.ReducedSystem(Oh0, dipole=Osin(config['dimH'], qo.QO.T_COMPLEX))

    # -- Run with QuTip
    kernel = QutipKernel(rs)
    kernel.compile()
    kernel.sync(t_bath=config['t_bath'], y_0=config['y_0'], state=rs.thermal_state(T=config['t_rho0']))
    tlist = qo.time_gatter(*config['tr'])
    (_, _, tstate, _) = kernel.run(tlist)

    # -- Run with OpenCL kernel
    kernelCL = OpenCLKernel(rs)
    kernelCL.optimize_jumps = True
    kernelCL.compile()
    kernelCL.sync(t_bath=config['t_bath'], y_0=config['y_0'], state=rs.thermal_state(T=config['t_rho0']))
    tlist_cl, resultCL = kernelCL.reader_rho_t(kernelCL.run(config['tr'], steps_chunk_size=1e4))

    # -- compare all states at all times
    assert_allclose(tlist, tlist_cl)
    assert_allclose(resultCL, tstate, **qo.QO.TEST_TOLS)
示例#2
0
def test_build_fail_1():
    dimH = 11

    Oh0 = Odn2(dimH, qo.QO.T_COMPLEX) - Ocos(dimH, qo.QO.T_COMPLEX)
    rs = qo.ReducedSystem(Oh0, dipole=Osin(dimH, qo.QO.T_COMPLEX))

    # -- Run with OpenCL kernel
    kernelCL = OpenCLKernel(rs)
    kernelCL.compile()
示例#3
0
def sjj_rs(dimH, EC, J0, dn_coupling=False):
    Oh0 = 0.5 * EC * Odn2(dimH) - J0 * Ocos(dimH)
    coupling = Odn(dimH) if dn_coupling else Osin(dimH)
    return qo.ReducedSystem(Oh0, dipole=coupling)
示例#4
0
#!/usr/local/bin/python3
import numpy as np
import qoptical as qo
from qoptical.kernel_opencl import OpenCLKernel

if __name__ == "__main__":
    qo.QO.DEBUG = True

    # two state system
    rs = qo.ReducedSystem([0, 0, 0, 1], dipole=[0, 1, 1, 0])

    # three states at different temperatures
    rho0 = rs.thermal_state(T=[0, 0.1, 0.2, 0.3])

    kernel = OpenCLKernel(system=rs)
    kernel.compile()
    kernel.sync(state=rho0, t_bath=[0, 0, 0, 15], y_0=0.5)

    runner = kernel.run((0, 200, 0.0005))
    tf, rhof = kernel.reader_tfinal_rho(runner)

    print(tf, np.round(rhof, 3))
    rhoth = rs.thermal_state(T=[0, 0, 0, 15])
    print(tf, np.round(rhoth, 3))
示例#5
0
def hosci_rs(dimH, EC, EJ, dn_coupling=False):
    """ reduced system H0 + coupling """
    coupling = 1.0j * (Oa(dimH) - Oad(dimH)) if dn_coupling else Ophi(dimH)
    return qo.ReducedSystem(Oh0(dimH, EC, EJ), dipole=coupling)