Skip to content

Commit

Permalink
Merge pull request #132 from frankwswang/dev
Browse files Browse the repository at this point in the history
Changed the threshold of oscillation detecting.
  • Loading branch information
frankwswang authored Feb 22, 2023
2 parents 598af9e + d3626cb commit 45499d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/HartreeFock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,8 @@ function runHFcore(::Val{HFT},
ΔD = vars[begin].shared.Dtots[end] - vars[begin].shared.Dtots[end-1]
ΔDrms = sqrt( sum(ΔD .^ 2) ./ length(ΔD) )
end

if n > 1 && (!isConverged || (bl = relDiff > 1e-3))
# ≈0.5kJ/mol
if n > 1 && (!isConverged || (bl = relDiff > max(sqrtBreakPoint, 2e-4)))
flag, Std = isOscillateConverged(Etots, 10breakPoint,
minLen=HFminItr,
maxRemains=HFinterEstoreSize)
Expand Down
6 changes: 3 additions & 3 deletions test/unit-tests/Differentiation-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ pars3 = markParams!(bs3, true)
S3 = overlaps(bs3)
HFres3 = runHF(bs3, nuc, nucCoords, DHFO, printInfo=false)
grad3 = gradOfHFenergy(pars3, HFres3)
grad3_fd = fDiffOfHFenergy(pars3, bs3, nuc, nucCoords, 1e-6)
compr2Arrays3((grad3p=grad3[1:end-1], grad3_fdp=grad3_fd[1:end-1]), 20t3, true)
grad3_fd = fDiffOfHFenergy(pars3, bs3, nuc, nucCoords, 1e-7)
compr2Arrays3((grad3p=grad3[1:end-1], grad3_fdp=grad3_fd[1:end-1]), 10t3, true)
@test isapprox(grad3[end], grad3_fd[end], atol=20t3)
grad3_t = [-0.16065229121206354, -0.24121983006131092, -0.14801056645961025,
0.004774655525683808, -0.08411038969476041, -0.33217356554081107,
Expand All @@ -165,7 +165,7 @@ grad3_t = [-0.16065229121206354, -0.24121983006131092, -0.14801056645961025,
1.2107782206334075, 0.1356557596514777, 1.606031495974234,
0.05883838067278252, 0.7017475880547892, -1.2886966023073554,
2.762948613007392, -16.536548387473335]
compr2Arrays3((grad3=grad3, grad3_t=grad3_t), 20t3, true)
compr2Arrays3((grad3=grad3, grad3_t=grad3_t), 10t3, true)


# Edge case of accurate gradient requiring high-precision computation
Expand Down

2 comments on commit 45499d4

@frankwswang
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/78284

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.4 -m "<description of version>" 45499d43c4418b1d35ac4982955e003bf66dc02a
git push origin v0.5.4

Please sign in to comment.