コード例 #1
0
ファイル: generate_one_comp_gs.py プロジェクト: fjarri/thesis
def get_gs(N):

    api = cluda.ocl_api()
    thr = api.Thread.create()

    comp = const.rb87_1_minus1
    freqs = (97.6, 97.6, 11.96)
    shape = (32, 32, 128)
    dtype = numpy.complex128

    scattering = const.scattering_matrix([comp])
    potential = HarmonicPotential(freqs)
    system = System([comp], scattering, potential=potential)
    box = box_for_tf(system, 0, N)
    grid = UniformGrid(shape, box)

    tf_gs = tf_ground_state(thr, grid, dtype, system, [N])
    gs = it_ground_state(thr, grid, dtype, system, [N],
        E_diff=1e-7, E_conv=1e-9, sample_time=1e-5)

    n_x = (numpy.abs(gs.data.get()) ** 2)[:, 0].sum((1, 2)) * grid.dxs[0] * grid.dxs[1]
    tf_n_x = (numpy.abs(tf_gs.data.get()) ** 2)[:, 0].sum((1, 2)) * grid.dxs[0] * grid.dxs[1]
    xs = grid.xs[2]

    return xs.tolist(), n_x.tolist(), tf_n_x.tolist()
コード例 #2
0
ファイル: generate_two_comp_gs.py プロジェクト: fjarri/thesis
def get_gs(N, a12):

    api = cluda.ocl_api()
    thr = api.Thread.create()

    comps = [const.rb87_1_minus1, const.rb87_2_1]
    freqs = (97.6, 97.6, 11.96)
    shape = (32, 32, 128)
    dtype = numpy.complex128

    scattering = const.scattering_3d(numpy.array([[100.4, a12], [a12, 95.44]]), comps[0].m)
    potential = HarmonicPotential(freqs)
    system = System(comps, scattering, potential=potential)
    box = box_for_tf(system, 0, N)
    grid = UniformGrid(shape, box)

    gs = it_ground_state(thr, grid, dtype, system, [N / 2, N / 2], E_diff=1e-7, E_conv=1e-9, sample_time=1e-4)

    n_x = (numpy.abs(gs.data.get()) ** 2)[:, 0].sum((1, 2)) * grid.dxs[0] * grid.dxs[1]
    xs = grid.xs[2]

    return xs.tolist(), n_x.tolist()