def main():
    # read cli args
    args = read_argv(sys.argv[1:])

    # check whether the file to persist the result
    # does allready exist.
    file_exists_check(args.fname, args.silent)

    # create config
    cfg = SigmaConfig(
        dimH=args.dimH,
        EC=args.EC,
        J0=args.J0,
        y0=args.y0,
        T=args.T,
        fft_t0=args.fft_t0,
        fft_ntp=args.fft_ntp,
        fft_sample=args.fft_sample,
        dt=args.dt,
    )

    # create (driving, H(t))
    driving = sys_probe(args.dimH, args.I0, args.wp)

    # calculate sigma
    sigma = opmesolve_ps_sjj(cfg, *driving, steps_chunk_size=args.chunk)

    # persist
    persist_fs(args.fname, cfg=cfg, systems=driving[0], sigma=sigma)
def main(argv):
    args = read_argv(argv[1:])
    assert_args(args)

    # exit / prompt user if fname does allready exist
    file_exists_check(args.fname, args.silent)

    # get OpenCL context+queue
    ctx, queue = cl_ctx_queue(args.cl_platform, args.cl_gpu_device)

    # create config
    cfg = Sin2Config(dimH=args.dimH,
                     EC=args.EC,
                     J0=args.J0,
                     y0=args.y0,
                     T=args.T,
                     avg_len=args.avg_len,
                     rec_skip=args.rec_skip,
                     tg=(args.t0, args.tf, args.dt),
                     yt_coeff=args.yt_coeff,
                     cmd=' '.join(argv))

    # create list of drivings [(Ad, wd), ]
    if len(args.wd) > 1 and len(args.Ad) == 1:
        drv = list(zip([args.Ad[0]] * len(args.wd), args.wd))
    elif len(args.Ad) > 1 and len(args.wd) == 1:
        drv = list(zip(args.Ad, [args.wd[0]] * len(args.Ad)))
    else:
        drv = list(zip(args.Ad, args.wd))

    # create reduced systems
    rs = sjj_rs(cfg.dimH, cfg.EC, cfg.J0, dn_coupling=args.dn_coupling)

    # create (driving, H(t))
    params, OHul = sys_parametric_driving(args.dimH, args.J0, drv)

    # create yt_coeff
    yt_coeff = None
    if args.yt_coeff:
        yt_coeff = lambda t, p: 1 + p['Ad'] * np.sin(p['wd'] * t)

    # calculate avg
    avg = opmesolve_avg_eq(rs=rs,
                           T=cfg.T,
                           y0=cfg.y0,
                           tg=cfg.tg,
                           params=params,
                           Oexpect=Osin2(cfg.dimH),
                           avg_len=cfg.avg_len,
                           OHul=OHul,
                           yt_coeff=yt_coeff,
                           steps_chunk_size=args.chunk,
                           rec_skip=cfg.rec_skip,
                           ctx=ctx,
                           queue=queue)

    # persist
    persist_fs_avg(args.fname, cfg=cfg, systems=params, avg=avg)
def main(argv):
    args = read_argv(argv[1:])
    assert_args(args)

    # exit / prompt user if fname does allready exist
    file_exists_check(args.fname, args.silent)

    # get OpenCL context+queue
    ctx, queue = cl_ctx_queue(args.cl_platform, args.cl_gpu_device)

    # create config
    cfg = SigmaConfig(dimH=args.dimH,
                      EC=args.EC,
                      J0=args.J0,
                      y0=args.y0,
                      T=args.T,
                      fft_t0=args.fft_t0,
                      fft_ntp=args.fft_ntp,
                      fft_sample=args.fft_sample,
                      dt=args.dt,
                      cmd=' '.join(argv))

    # create list of drivings [(Ad, wd), ]
    if len(args.wd) > 1 and len(args.Ad) == 1:
        drv = list(zip([args.Ad[0]] * len(args.wd), args.wd))
    elif len(args.Ad) > 1 and len(args.wd) == 1:
        drv = list(zip(args.Ad, [args.wd[0]] * len(args.Ad)))
    else:
        drv = list(zip(args.Ad, args.wd))

    # create reduced systems
    rs = hosci_rs(cfg.dimH, cfg.EC, cfg.J0, dn_coupling=args.dn_coupling)

    # create (driving, H(t))
    params, OHul = sys_parametric_driving(args.dimH, args.EC, args.J0, drv,
                                          args.I0, args.wp)

    # calculate sigma
    sigma, _ = opmesolve_probe(Ov=Ov(cfg.dimH, cfg.EC, cfg.J0),
                               rs=rs,
                               T=cfg.T,
                               y0=cfg.y0,
                               fft_t0=cfg.fft_t0,
                               fft_ntp=cfg.fft_ntp,
                               fft_sample=cfg.fft_sample,
                               dt=cfg.dt,
                               params=params,
                               OHul=OHul,
                               steps_chunk_size=args.chunk,
                               ctx=ctx,
                               queue=queue)

    # persist
    persist_fs(args.fname, cfg=cfg, systems=params, sigma=sigma)
def main(argv):
    args = read_argv(argv[1:])
    assert_args(args)

    # exit / prompt user if fname does allready exist
    file_exists_check(args.fname, args.silent)

    # get OpenCL context+queue
    ctx, queue = cl_ctx_queue(args.cl_platform, args.cl_gpu_device)

    # create config
    cfg = SigmaConfig(dimH=args.dimH,
                      EC=args.EC,
                      J0=args.J0,
                      y0=args.y0,
                      T=args.T,
                      fft_t0=args.fft_t0,
                      fft_ntp=args.fft_ntp,
                      fft_sample=args.fft_sample,
                      drv_arr=json.loads(args.drv_arr),
                      dt=args.dt,
                      cmd=' '.join(argv))

    # create reduced systems
    rs = sjj_rs(cfg.dimH, cfg.EC, cfg.J0)

    # voltage operator
    Ov = Osjj_V(cfg.dimH, cfg.EC)

    # create (driving, H(t))
    params, OHul = sys_parametric_hh_driving(args.dimH, args.J0, cfg.drv_arr,
                                             args.I0, args.wp)

    # calculate sigma
    sigma, _ = opmesolve_probe(Ov=Ov,
                               rs=rs,
                               T=cfg.T,
                               y0=cfg.y0,
                               fft_t0=cfg.fft_t0,
                               fft_ntp=cfg.fft_ntp,
                               fft_sample=cfg.fft_sample,
                               dt=cfg.dt,
                               params=params,
                               OHul=OHul,
                               steps_chunk_size=args.chunk,
                               ctx=ctx,
                               queue=queue)

    # persist
    persist_fs(args.fname, cfg=cfg, systems=params, sigma=sigma)
def main(argv):
    args = read_argv(argv[1:])
    assert_args(args)

    # exit / prompt user if fname does allready exist
    file_exists_check(args.fname, args.silent)

    # get OpenCL context+queue
    ctx, queue = cl_ctx_queue(args.cl_platform, args.cl_gpu_device)

    # create config
    cfg = SigmaConfig(
        dimH=args.dimH,
        EC=args.EC,
        J0=args.J0,
        y0=args.y0,
        T=args.T,
        fft_t0=args.fft_t0,
        fft_ntp=args.fft_ntp,
        fft_sample=args.fft_sample,
        dt=args.dt,
        yt_coeff=args.yt_coeff,
        cmd=' '.join(argv)
    )

    # create list of drivings [(Ad, wd), ]
    if len(args.wd) > 1 and len(args.Ad) == 1:
        drv = list(zip([args.Ad[0]] * len(args.wd), args.wd))
    elif len(args.Ad) > 1 and len(args.wd) == 1:
        drv = list(zip(args.Ad, [args.wd[0]] * len(args.Ad)))
    else:
        drv = list(zip(args.Ad, args.wd))

    # create reduced systems
    rs = sjj_rs(cfg.dimH, cfg.EC, cfg.J0, dn_coupling=args.dn_coupling)

    # voltage operator
    Ov = Osjj_V(cfg.dimH, cfg.EC)

    # create (driving, H(t))
    params, OHul = sys_parametric_driving(args.dimH, args.J0, drv, args.I0, args.wp)

    # create yt_coeff
    yt_coeff = None
    if args.yt_coeff:
        yt_coeff = lambda t, p: 1 + p['Ad'] * np.sin(p['wd'] * t)

    # Experimental ------------------------------------------------------------------------------------------
    #
    # we try some possibilities to work with dynamical coupling. This section might be removed
    # if this idea turns out to be a one-way.
    #
    kappa = None
    if args.kappa is not None:
        if args.kappa == 'kappa1':
            def kappa(T, p, w):
                return stationary(T, p, w) + p['Ad']**2 / 4 * (
                    stationary(T, p, w + p['wd']) + stationary(T, p, w - p['wd'])
                )
        elif args.kappa == 'kappa2':
            def kappa(T, p, w):
                if T == 0:
                    return w * np.heaviside(w, 0)
                return w * (1.0 + 1.0 / (np.exp(1.0 / T * w) - 1 + 0.0000000001))
        else:
            err = 'invalid kappa "{}"'
            raise ValueError(err.format(args.kappa))
    # Experimental ------------------------------------------------------------------------------------------

    # calculate sigma
    sigma, _ = opmesolve_probe(
        Ov=Ov,
        rs=rs,
        T=cfg.T,
        y0=cfg.y0,
        fft_t0=cfg.fft_t0,
        fft_ntp=cfg.fft_ntp,
        fft_sample=cfg.fft_sample,
        dt=cfg.dt,
        params=params,
        OHul=OHul,
        yt_coeff=yt_coeff,
        kappa=kappa,
        steps_chunk_size=args.chunk,
        ctx=ctx,
        queue=queue)

    # persist
    persist_fs(args.fname, cfg=cfg, systems=params, sigma=sigma)