forked from jcosborn/qhmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qwilson.lua
165 lines (148 loc) · 3.82 KB
/
qwilson.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package.path = arg[0]:gsub("[^/]*.lua","?.lua") .. ";./hmc/?.lua;" .. package.path
require 'common'
require 'run'
--require 'mg'
trace(doTrace)
local nx = nx or 4
local nt = nt or 8
local beta = beta or 4
local u0 = u0 or 1
local nf = nf or 0
local mass = mass or 0.0
_G.mass = mass
local rhmc = {}
local hmcmasses = { }
--local hmcmasses = { mass }
--local hmcmasses = { mass, 20*mass }
local seed = 1316844761
--local inlat = nil
--local inlat = "f8x88b40m01.100"
--local inlat = "l84f8b40m04a.2700.scidac"
--local outlat = nil
--local outlat = "f8x88b40m01.100"
local ntraj = ntraj or 10
local tau = tau or 0.1
local ngsteps = ngsteps or 240
local nfsteps = nfsteps or { 80 }
--local nfsteps = { 80, 80 }
nfsteps = repelem(nfsteps, nf/2)
local grcg = { prec=2, resid=1e-10, restart=500 }
local facg = { prec=2, resid=1e-10, restart=500 }
local mdcg = { prec=2, resid=1e-10, restart=500 }
local ffprec = 2
--local gintalg = {type="leapfrog"}
--local gintalg = {type="omelyan"}
--local gintalg = {type="omelyan", lambda=0.2}
local gintalg = {type="omelyan", lambda=0.33}
--local fintalg = {type="omelyan", lambda=0.2}
local fintalg = {type="omelyan", lambda=0.33}
local pbp = {}
pbp[1] = { reps=1 }
pbp[1].mass = mass
pbp[1].resid = 1e-6
pbp[1].opts = { restart=500, max_restarts=5, max_iter=2000 }
local smear = {}
--smear[#smear+1] = { type="fat7", coeffs={one_link=1} }
--smear[#smear+1] = { type="fat7", coeffs={one_link=0.5} }
--smear[#smear+1] = { type="fat7", coeffs={one_link=2} }
--smear[#smear+1] = { type="fat7", coeffs={three_staple=0.2} }
--smear[#smear+1] = { type="fat7", coeffs={one_link=0.4,three_staple=0.1} }
--smear[#smear+1] = { type="stout", rho=0.01 }
--smear[#smear+1] = { type="stout", rho=0.14 }
--- end of parameters
-- A =
function setpseudo(rhmc, mf, mb)
--kf = 0.5/(4+mf)
if mb then -- term (A+4mb^2)/(A+4mf^2)
local s2 = 4*mb*mb
local sr = math.sqrt(s1*s2)
local c1 = s1 + s2 - 2*sr
rhmc[#rhmc+1] = {
GR = {
{ {1}, {sr-s2, s2} },
{ {math.sqrt(c1), s2}, allfaceven=0, allfacodd=1 }
},
FA = {
{ {1} },
{ {math.sqrt(s2-s1), s1}, allfaceven=2*mf, allfacodd=1 }
},
MD = { {1}, {s2-s1, s1} }
}
else -- term 1/[(1-A)(1-A^+)]
rhmc[#rhmc+1] = {
GR = { mf },
FA = { mf },
MD = { mf }
}
end
end
for i=1,#hmcmasses do
for j=1,nf/2 do
if i<#hmcmasses then
setpseudo(rhmc, hmcmasses[i], hmcmasses[i+1])
else
setpseudo(rhmc, hmcmasses[i])
end
end
end
local npseudo = #rhmc
local p = {}
p.latsize = { nx, nx, nx, nt }
latsize = p.latsize
p.seed = seed or os.time()
p.beta = beta
p.nf = nf
p.u0 = u0
--p.gaugeact = {type="symanzik_1loop_hisq", u0=p.u0, nf=p.nf}
p.gaugeact = {type="plaquette"}
p.npseudo = npseudo
p.fermact = {type="wilson", rhmc=rhmc}
p.fermact.smear = smear
local rhmc0 = copy(rhmc)
local acts = setupacts(p)
--myprint("rhmc0 = ", rhmc0, "\n")
local r = {}
r.ntraj = ntraj
r.tau = tau
local fp = {}
r.forceparams = fp
fp[1] = {}
fp[1][1] = {nsteps=ngsteps, intalg=gintalg}
local rhmc1 = {}
for j=1,npseudo do
--printf("j = %i\n", j)
--printf("ns = %i\n", nfsteps[j])
fp[1][j+1] = {nsteps=nfsteps[j], intalg=fintalg}
rhmc1[j] = {GR={},FA={},MD={}}
rhmc1[j].GR.resid = grcg.resid
rhmc1[j].FA.resid = facg.resid
rhmc1[j].MD.resid = mdcg.resid
rhmc1[j].GR.solveopts = {
prec = grcg.prec,
restart = grcg.restart
}
rhmc1[j].FA.solveopts = {
prec = facg.prec,
restart = facg.restart
}
rhmc1[j].MD.solveopts = {
prec = mdcg.prec,
restart = mdcg.restart
}
rhmc1[j].MD.ffprec = ffprec
end
--myprint("rhmc1 = ", rhmc1, "\n")
copyto(rhmc, rhmc1)
r.pbp = pbp
--myprint("runparams = ", r, "\n")
if inlat then
acts:load(inlat)
local ps,pt = acts.fields.G:plaq()
printf("plaq ss: %g st: %g tot: %g\n", ps, pt, 0.5*(ps+pt))
else
acts:unit()
end
acts:run(r)
if outlat then
acts:save(outlat)
end