Skip to content

Commit

Permalink
add some clarification re formulas trick gaucomp
Browse files Browse the repository at this point in the history
  • Loading branch information
aoterodelaroza committed Feb 19, 2024
1 parent a8d8aa2 commit 5ce5953
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tricks.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,7 @@ subroutine diff_fun(val, n, x, grad, need_gradient, f_data)
c1%gtensor(2,3) = b * c * calp
c1%gtensor(3,2) = c1%gtensor(2,3)
c1%gtensor(3,3) = c * c

if (det3sym(c1%gtensor) < 0d0) then
val = huge(1d0)
if (need_gradient /= 0) grad = 0d0
Expand All @@ -3227,9 +3228,12 @@ subroutine diff_fun(val, n, x, grad, need_gradient, f_data)
! write output
val = 1d0 - diff
if (need_gradient /= 0) then
! derivatives wrt Gij
! derivatives wrt Gij (the 0.5 in the second term is missing
! because there are two dfgg11, one from each "1"
diffg = -diff * (dfgg12 / dfg12 - dfgg11 / dfg11)

! Off-diagonal components (2,3,5) are half what they should
! be because we did not impose symmetric matrix
grad(1) = a * diffg(1) + b * cgam * diffg(2) + c * cbet * diffg(3)
grad(2) = a * cgam * diffg(2) + b * diffg(4) + c * calp * diffg(5)
grad(3) = a * cbet * diffg(3) + b * calp * diffg(5) + c * diffg(6)
Expand Down

0 comments on commit 5ce5953

Please sign in to comment.