コード例 #1
0
ファイル: mfmcg.py プロジェクト: cationly/MFMCG
from os import mkdir, getcwd
from cPickle import dump
from math import log10
from hamiltonian import ham
from metropolis import metropolis
from mfiter import RT
from datrendering import datname

cutoff=0.0032
h = ham(width=4,length=5,boundary='o',holes=[11])
ncir = 110
T = 100.0

lcir = int(log10(ncir)) + 1
dpath = 'data/'
ddir = dpath + datname(T,h.g) + '/'

print 'data stored in', ddir
try:
   mkdir(dpath)
except:
   print dpath,'exist'
try:
   mkdir(ddir)
except:
   raise OSError('Directory ' + ddir + ' exists.')

mt = metropolis(h,T=T*RT,cutoff=cutoff)
for i in xrange(ncir):
   df = open(ddir + 'c' + str(i).zfill(lcir) + '.dat', 'w')
   d, n, en, a = mt.next()
コード例 #2
0
ファイル: test9.py プロジェクト: kumkee/MFMCG
from hamiltonian import ham
from metropolis import metropolis

cutoff = 0.003
h = ham(length=5, width=4, holes=[[2, 1]])
mt = metropolis(h, cutoff=cutoff)
for i in xrange(10):
    d, n, en, a = mt.next()
    print ""
    print "*****************"
    print "   Cycle %s      " % (i)
    print "*****************"
    print ""
    print "Acceptance rate:", a
    print ""
    print "Average particle densities:"
    print n
    print ""
    print "Average displacements:"
    print d
コード例 #3
0
ファイル: test3.py プロジェクト: cationly/MFMCG
print "ndvertex:",a.ndvertex()
print "pbn of hole:",a.pbneighb([0,5])
print "nlines:",a.nlines()
b = a.lslines()
print "len(lslines()):",len(b)
#drawhoneycomb(a,output="h.eps")
#drawgraphene(a,output="g.eps")
'''ppservers=()
ncpus=6
job_server = pp.Server(ncpus,ppservers=ppservers)
job = job_server.submit(drawhoneycomb,(a,'g-','a.eps'),(jmultp,jtwop,savefig),("graphene","drawing","pylab","numpy"))
print job()
job_server.print_stats()'''
a._displace(0,[0.1,0.1])
from hamiltonian import ham
print "h = ham(graphene=a)"
h = ham(graphene=a)
print "h.g.size(1)",h.g.size(1)
print "h.osc",h.osc
hh = h.g.holes()[0]
print "h.g.hole", hh
hn = h.g.neighb(hh,'1d')[0]
print "link(hn,hh):", h.g.link(hn,hh)
print "h.osc",h.osc
print "h.displace(0,[0.1,0.1])"
h.displace(0,[0.1,0.1])
print "h.osc",h.osc
c = eden(h)
print "c = eden(h)"
print h.Hj(0,c,[192,192])
コード例 #4
0
from hamiltonian import ham
from drawing import *
from edensity import *
from sympy import *
from copy import deepcopy

U, J, d, o, a, V0, V1, V2, s = symbols('U J d o a V0 V1 V2 s')
h = ham(width=4,
        length=5,
        boundary='p',
        holes=[[2, 2]],
        coulomb=U,
        spincoupling=J,
        Ed=d,
        vibration=o,
        ssh=a)
c = eden(h)
c.V = [V0, V1, V2]
#drawgraphene(h.g,output='hg.eps')
print "h:", h
print "c:", c
b = deepcopy(c)
s = .9
b.eden = array(map(lambda x: x + (-1)**x * s, c.eden))
mt = array([h.Ht([i, j]) for j in range(h.dim) for i in range(h.dim)])
mt.shape = h.dim, h.dim
mo = array([h.Ho([i, j]) for j in range(h.dim) for i in range(h.dim)])
mo.shape = h.dim, h.dim
h.displace(1, [.01, .01])
mt = array([h.Ht([i, j]) for j in range(h.dim) for i in range(h.dim)])
mt.shape = h.dim, h.dim
コード例 #5
0
from os import mkdir, getcwd
from cPickle import dump
from math import log10
from hamiltonian import ham
from metropolis import metropolis
from mfiter import RT
from datrendering import datname

cutoff = 0.0032
h = ham(width=4, length=5, boundary='o', holes=[11])
ncir = 110
T = 100.0

lcir = int(log10(ncir)) + 1
dpath = 'data/'
ddir = dpath + datname(T, h.g) + '/'

print 'data stored in', ddir
try:
    mkdir(dpath)
except:
    print dpath, 'exist'
try:
    mkdir(ddir)
except:
    raise OSError('Directory ' + ddir + ' exists.')

mt = metropolis(h, T=T * RT, cutoff=cutoff)
for i in xrange(ncir):
    df = open(ddir + 'c' + str(i).zfill(lcir) + '.dat', 'w')
    d, n, en, a = mt.next()
コード例 #6
0
ファイル: test4.py プロジェクト: cationly/MFMCG
from hamiltonian import ham
from drawing import *
from edensity import *
from sympy import *
from copy import deepcopy

U, J, d, o, a, V0, V1, V2, s = symbols('U J d o a V0 V1 V2 s')
h = ham(width=4,length=5,boundary='p',holes=[[2,2]],
	coulomb=U, spincoupling=J, Ed=d, vibration=o, ssh=a)
c = eden(h)
c.V = [V0, V1, V2]
#drawgraphene(h.g,output='hg.eps')
print "h:", h
print "c:", c
b = deepcopy(c)
s = .9
b.eden = array(map(lambda x:x+(-1)**x*s, c.eden))
mt = array([h.Ht([i,j]) for j in range(h.dim) for i in range(h.dim)]);mt.shape = h.dim, h.dim
mo = array([h.Ho([i,j]) for j in range(h.dim) for i in range(h.dim)]);mo.shape = h.dim, h.dim
h.displace(1,[.01,.01])
mt = array([h.Ht([i,j]) for j in range(h.dim) for i in range(h.dim)]);mt.shape = h.dim, h.dim
mo = array([h.Ho([i,j]) for j in range(h.dim) for i in range(h.dim)]);mo.shape = h.dim, h.dim
h.displace(6,[0.,-.02])
mt = array([h.Ht([i,j]) for j in range(h.dim) for i in range(h.dim)]);mt.shape = h.dim, h.dim
mo = array([h.Ho([i,j]) for j in range(h.dim) for i in range(h.dim)]);mo.shape = h.dim, h.dim
h.displace(4,[0.,.02])
mt = array([h.Ht([i,j]) for j in range(h.dim) for i in range(h.dim)]);mt.shape = h.dim, h.dim
mo = array([h.Ho([i,j]) for j in range(h.dim) for i in range(h.dim)]);mo.shape = h.dim, h.dim
mu0 = array([h.Hu(0,c,[i,j]) for j in range(h.dim) for i in range(h.dim)]);mu0.shape = h.dim, h.dim
mu1 = array([h.Hu(1,c,[i,j]) for j in range(h.dim) for i in range(h.dim)]);mu1.shape = h.dim, h.dim
mu0b = array([h.Hu(0,b,[i,j]) for j in range(h.dim) for i in range(h.dim)]);mu0b.shape = h.dim, h.dim
コード例 #7
0
ファイル: test3.py プロジェクト: fagan2888/MFMCG
print "ndvertex:", a.ndvertex()
print "pbn of hole:", a.pbneighb([0, 5])
print "nlines:", a.nlines()
b = a.lslines()
print "len(lslines()):", len(b)
#drawhoneycomb(a,output="h.eps")
#drawgraphene(a,output="g.eps")
'''ppservers=()
ncpus=6
job_server = pp.Server(ncpus,ppservers=ppservers)
job = job_server.submit(drawhoneycomb,(a,'g-','a.eps'),(jmultp,jtwop,savefig),("graphene","drawing","pylab","numpy"))
print job()
job_server.print_stats()'''
a._displace(0, [0.1, 0.1])
from hamiltonian import ham
print "h = ham(graphene=a)"
h = ham(graphene=a)
print "h.g.size(1)", h.g.size(1)
print "h.osc", h.osc
hh = h.g.holes()[0]
print "h.g.hole", hh
hn = h.g.neighb(hh, '1d')[0]
print "link(hn,hh):", h.g.link(hn, hh)
print "h.osc", h.osc
print "h.displace(0,[0.1,0.1])"
h.displace(0, [0.1, 0.1])
print "h.osc", h.osc
c = eden(h)
print "c = eden(h)"
print h.Hj(0, c, [192, 192])
コード例 #8
0
from hamiltonian import ham
from metropolis import metropolis

cutoff=0.003
h = ham(length=5,width=4,holes=[[2,1]])
mt = metropolis(h,cutoff=cutoff)
for i in xrange(10):
   d, n, en, a = mt.next()
   print ''
   print '*****************'
   print '   Cycle %s      ' % (i)
   print '*****************'
   print ''
   print 'Acceptance rate:', a
   print ''
   print 'Average particle densities:'
   print n
   print ''
   print 'Average displacements:'
   print d