Skip to content

Commit

Permalink
force tau gradient to be negative for large deltaH
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Jun 28, 2024
1 parent 20dc00b commit 59ede49
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/experimental/stagag.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ proc getCost(m: Met): seq[float] =
# grad (p = min(1,exp(ho-hn))) -> 0 or - p grad(hn)
var pg = 0.0
if m.hNew > m.hOld:
pg = - m.pAccept * params[i].grad
pg = - pm * params[i].grad
paccg[i].push pg
#pg = paccg[i].mean
var costg = (if i==0: 2.0*nsteps*ct*pm else: 0.0)
Expand All @@ -1404,6 +1404,9 @@ proc getCost(m: Met): seq[float] =
#costg += alp*d*(d*pg + 2*(pm-1)*params[i].grad)
costg = costg/fc - (ct*ct*pm/(fc*fc))*forceCostGrad(i)
#costg = nff*costg*(cost*cost) # extra - to make it minimize
if i==0:
if m.deltaH > 10:
costg = -0.1
if fixtau and i==0: costg = 0
if fixhmasses and i>0 and i<=hmasses.len: costg = 0
if fixparams and i>hmasses.len: costg = 0
Expand Down

0 comments on commit 59ede49

Please sign in to comment.