-
Notifications
You must be signed in to change notification settings - Fork 97
Add more convergence history to scfres #1049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ClementineBarat
wants to merge
15
commits into
JuliaMolSim:master
Choose a base branch
from
ClementineBarat:scfres_history
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4df6a0f
new history in scfres
ClementineBarat 337ef9c
removing psi history
ClementineBarat f477597
merge
ClementineBarat 1854c53
adding extra history
ClementineBarat 0bb7ecb
corrections
ClementineBarat ec004d1
removing history_eigenvalues
ClementineBarat dd33eed
Merge branch 'master' into scfres_history
ClementineBarat 7dfdea2
SaveHistory Callback
ClementineBarat 8b6be12
corrections
ClementineBarat ba01eae
Merge branch 'scfres_history' of github.com:ClementineBarat/DFTK.jl i…
ClementineBarat 09ad40c
Not adding history_extra to scfres
ClementineBarat 74e7cfb
removing history Callback
ClementineBarat bbc2c19
Merge branch 'master' into scfres_history
mfherbst e4fcccb
corrections
ClementineBarat b00f483
Merge branch 'scfres_history' of github.com:ClementineBarat/DFTK.jl i…
ClementineBarat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,11 +180,15 @@ Overview of parameters: | |
| if compute_consistent_energies | ||
| (; energies) = energy(basis, ψ, occupation; ρ=ρout, eigenvalues, εF) | ||
| end | ||
|
|
||
| # Update info with history | ||
| history_Etot = vcat(info.history_Etot, energies.total) | ||
| history_Δρ = vcat(info.history_Δρ, norm(Δρ) * sqrt(basis.dvol)) | ||
| history_εF = vcat(info.history_εF, εF) | ||
| n_matvec = info.n_matvec + nextstate.n_matvec | ||
| info_next = merge(info_next, (; energies, history_Etot, history_Δρ, n_matvec)) | ||
|
|
||
| info_next = merge(info_next, (; energies, history_Etot, history_Δρ, history_εF, | ||
| n_matvec)) | ||
|
|
||
| # Apply mixing and pass it the full info as kwargs | ||
| ρnext = ρin .+ T(damping) .* mix_density(mixing, basis, Δρ; info_next...) | ||
|
|
||
|
|
@@ -202,8 +206,7 @@ Overview of parameters: | |
|
|
||
| info_init = (; ρin=ρ, ψ=ψ, occupation=nothing, eigenvalues=nothing, εF=nothing, | ||
| n_iter=0, n_matvec=0, timedout=false, converged=false, | ||
| history_Etot=T[], history_Δρ=T[]) | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you're killing an empty line, which I think would help the structure of the code. |
||
| history_Etot=T[], history_Δρ=T[], history_εF=T[]) | ||
| # Convergence is flagged by is_converged inside the fixpoint_map. | ||
| _, info = solver(fixpoint_map, ρ, info_init; maxiter) | ||
|
|
||
|
|
@@ -217,8 +220,8 @@ Overview of parameters: | |
| scfres = (; ham, basis, energies, converged, nbandsalg.occupation_threshold, | ||
| ρ=ρout, α=damping, eigenvalues, occupation, εF, info.n_bands_converge, | ||
| info.n_iter, info.n_matvec, ψ, info.diagonalization, stage=:finalize, | ||
| info.history_Δρ, info.history_Etot, info.timedout, | ||
| runtime_ns=time_ns() - start_ns, algorithm="SCF") | ||
| info.history_Δρ, info.history_Etot, info.history_εF, | ||
| info.timedout, runtime_ns=time_ns() - start_ns, algorithm="SCF") | ||
| callback(scfres) | ||
| scfres | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the indention is weird, I'd do