コード例 #1
0
ファイル: overhead.py プロジェクト: M0nd4/lattice-gas
lattice = Lattice(sz, dim = 2)
potential = Potential(inter, 1.0, 5)
sys = System(lattice, potential)
sys.set_mu(8.0)
sys.set_T(20.0)


steps = range(1, 201)
Trun = []
Tpy = []
Tc = []
for i in steps:
    print i
    t1 = time()
    for j in xrange(i):
        sys.whole_lattice()
    t2 = time()
    Tpy.append(1000*(t2-t1))
    t1 = time()
    sys.run(i)
    t2 = time()
    Trun.append(1000*(t2-t1))
    t1 = time()
    sys.crun(i)
    t2 = time()
    Tc.append(1000*(t2-t1))
steps = array(steps)
Trun = array(Trun)
Tpy = array(Tpy)
Tc = array(Tc)
plot(steps, Tpy/steps, steps, Trun/steps, steps, Tc/steps)
コード例 #2
0
inter = lambda r: -4
lattice = Lattice(sz, dim=2)
potential = Potential(inter, 1.0, 5)
sys = System(lattice, potential)
sys.set_mu(8.0)
sys.set_T(20.0)

steps = range(1, 201)
Trun = []
Tpy = []
Tc = []
for i in steps:
    print i
    t1 = time()
    for j in xrange(i):
        sys.whole_lattice()
    t2 = time()
    Tpy.append(1000 * (t2 - t1))
    t1 = time()
    sys.run(i)
    t2 = time()
    Trun.append(1000 * (t2 - t1))
    t1 = time()
    sys.crun(i)
    t2 = time()
    Tc.append(1000 * (t2 - t1))
steps = array(steps)
Trun = array(Trun)
Tpy = array(Tpy)
Tc = array(Tc)
plot(steps, Tpy / steps, steps, Trun / steps, steps, Tc / steps)