コード例 #1
0
ファイル: model.py プロジェクト: ThatSnail/chimera
    N = 4
    g = make_chimera_graph(N)

    magnet_frames = []
    draw_chimera_graph(g, N, magnet_frames)

    TEMP = 0.22
    problem = Problem(g, TEMP)

    xs = []
    ys = []
    # screenshot_schedule = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
    # screen_index = 0

    # sleep(5)
    while not problem.is_finished():
        prev_time = problem._time
        problem.iterate()

        # if prev_time <= screenshot_schedule[screen_index] and \
        #   problem._time >= screenshot_schedule[screen_index]:
        #    getoutput("xwd -name \"Chimera Graph\" | convert xwd:- images/image_{0:03}.png".format(int(problem._time * 100)))
        #    screen_index += 1

        energy = problem.hamiltonian()
        xs.append(problem._time)
        ys.append(energy)
        print(problem._time, energy)

    xs = np.array(xs)
    ys = np.array(ys)