Skip to content

Commit

Permalink
change force metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Jul 3, 2024
1 parent 2dc8497 commit 5ae368d
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/experimental/stagag.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,11 @@ proc resetMeasure =
for i in 0..<ffStats.len:
ffStats[i].clear

proc fstats(s: RunningStat): string =
let f2 = sqrt(s.variance)
let f4 = f2*sqrt(sqrt((s.kurtosis+3.0)))
result = &"{s.mean:8.6f} max {s.max:8.6f} std {f2:8.6f} m4 {f4:8.6f}"

proc measure =
#threads:
# g.rephase
Expand All @@ -1703,20 +1708,29 @@ proc measure =
# let k = nt2 - 1 - i
# echo i, " ", picorr[k].mean, " ", picorr[k].standardDeviationS
#discard
let sf = 1.0/(lat.len.float*lo.physVol.float*8.0) # 8 SU3 generators
#let sf = 1.0/(lat.len.float*lo.physVol.float*8.0) # 8 SU3 generators
var gfs: RunningStat
for i in 0..<gfList.len:
#let f2 = momvs[gfList[i]].obj.norm2
#gfStats.push gfeList[i].obj*sqrt(sf*f2)
let gfs = momvs[gfList[i]].obj.rmsStats gfeList[i].obj
gfStats += gfs
echo &"RMS gforce: {gfStats.mean:8.6f} max {gfStats.max:8.6f} std {gfStats.standardDeviationS:8.6f}"
#let gfs = momvs[gfList[i]].obj.rmsStats gfeList[i].obj
let t = momvs[gfList[i]].obj.rmsStats (1.5/gfList.len) # 1.5=sqrt(18/8)
gfs += t
echo "GF: ", fstats(gfs)
gfStats += gfs
for i in 0..<ffList.len:
var ffs: RunningStat
for j in 0..<ffList[i].len:
#let f2 = momvs[ffList[i][j]].obj.norm2
#ffStats[i].push abs(ffeList[i][j].obj)*sqrt(sf*f2)
let ffs = momvs[ffList[i][j]].obj.rmsStats abs(ffeList[i][j].obj)
ffStats[i] += ffs
echo &"RMS fforce {i}: {ffStats[i].mean:8.6f} max {ffStats[i].max:8.6f} std {ffStats[i].standardDeviationS:8.6f}"
#let ffs = momvs[ffList[i][j]].obj.rmsStats abs(ffeList[i][j].obj)
let t = momvs[ffList[i][j]].obj.rmsStats (1.5/ffList[i].len) # 1.5=sqrt(18/8)
ffs += t
echo "FF", i, ": ", fstats(ffs)
ffStats[i] += ffs
echo "TGF: ", fstats(gfStats)
for i in 0..<ffList.len:
echo "TFF", i, ": ", fstats(ffStats[i])

case md
of "aba": setupMDaba()
Expand Down

0 comments on commit 5ae368d

Please sign in to comment.