-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* allow different type replicas * QMCState add step and laststep, remove magic access, * remove params from ReplicaState; remove shiftMode; post_step_action * docstrings about deprecating params * fix doctest * move s_strat and τ_strat into ReplicaState * update structs * shift_parameters in ReplicaState * remove TripleLogUpdate * activate update_shift! * clean up and fix allocations * rename update_shift_parameters!, fix CI * error message for deprecated TripleLogUpdate * stricter compat bound for tests * QMCProblem * more tests * use SimulationPlan in QMCState * iterate for FrozenDVec * equality and walkernumber for FrozenDVec * start QMCSimulation * fix tests * update test project * again * store random seed in QMCProblem * status flags; seed rng in QMCSimulation * step! * more stats for report * solve! * progress bar * rename option seed to random_seed, add tests * Tables.jl integration for Report * iteration and Tables.jl interface for QMCSimulation * lomc! calls solve! * deprecate use of lomc! with AbstractMatrix, bump version * finalize_report! does not convert to DataFrame * rename QMCProblem to FCIQMCProblem, add docs * fix doctests * fix doc error * fix bug in QMCSimulation; status metadata; continue with solve!() * fix bug and docstring error from code review * delete commented code and deprecated types * rename report_after_step to report_after_step! * rename ReplicaState to SingleState * rename QMCState.replicas to QMCState.replica_states * fix allocation tests * rename QMCState.replica to QMCState.replica_strategy * re-enable replica keyword in lomc! * rename QMCState.r_strat to QMCState.reporting_strategy * rename refine_r_strat to refine_reporting_strategy * rename post_step to post_step_strategy * rename QMCState to ReplicaState, move states to new file * new SpectralState; tests fail * Exact diagonalization problem (#251) * keys, values and tests for FrozenDVec * ExactDiagonalizationProblem * KrylovKitDirect and LinearAlgebraEigen * fix tests * fix test again * fix doctest * fix again * new attempt * another go * explicitly import eigen * fix bug in test * more time steps for test * test don't fail with pre-v1.9 julia * support and test older Julia versions down to v1.7 * fix rare test failure * fix mpi_runtests on older versions * ArpackEigs * howmany and success fields in ED results * more consistent show method * LOBPCG * fix test * make ED tests reproducible * ExactDiagonalization module * yield `success` on iteration of solve result * rename solvers, matrix_free keyword * LazyDVecs * EDResult for IterativeSolversExt * all algorithms now use EDResult * simplify keyword argument handling * changes from code review * fix tests * whitespace only * Apply suggestions from code review Co-authored-by: mtsch <matijacufar@gmail.com> * suggestions from code review * rename BasisSetRep to BasisSetRepresentation, deprecate BasisSetRep * bump julia compat to v1.9, remove save_dvec and load_dvec * better tests * print diagnostic infor * re-seed rng * different seed * make convergence optional when testing LOBPCG * Apply suggestions from code review Co-authored-by: mtsch <matijacufar@gmail.com> * changed .sm to .sparse_matrix and .h to .hamiltonian * fix doctest * fix doctest --------- Co-authored-by: Joachim Brand <joachim.brand@gmail.com> Co-authored-by: mtsch <matijacufar@gmail.com> * state_vectors, single_states * fix tests * fix allocation tests * docs * fix documentation * rename FCIQMCProblem to ProjectorMonteCarloProblem * make QMCSimulation mutable * fiddle with state_vectors * keyword argument algorithm for ProjectorMonteCarloProblem * rename spectral_states to single_states, replica_states to spectral_states * rename QMCSimulation to PMCSimulation * rename fields in SingleState * improve tests * allow change strategies for continuation solve! * shift_strategy and time_step_strategy now live inside FCIQMC * docstring fix * change lomc! to use solve! * export num_replicas and num_spectral_states; new way of setting up starting vectors * suggestions from code review * enforce integer argument for AllOverlaps * getindex for ReplicaState and SpectralState * StateVectors * remove algorithm from PMCSimulation, remove algorithm and hamiltonian from ReplicaState * export GramSchmidt * rename files * fix benchmarks * BHM-example.jl uses new code; docstring for PMCProblem * fix error * typos * suggestions from code review * reuse working memory * typo and tests * change default for default_starting_vector * tweaks to BHM-example * fix solve documentation * cross reference the solve docstrings * fix algorithm bug * remove spurious import --------- Co-authored-by: Joachim Brand <joachim.brand@gmail.com> Co-authored-by: mtsch <matijacufar@gmail.com>
- Loading branch information
1 parent
ff1ee34
commit cb06628
Showing
63 changed files
with
3,884 additions
and
1,859 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Exact Diagonalization | ||
|
||
The main functionality of Rimu for exact diagonalization is contained in the module `ExactDiagonalization`. | ||
|
||
```@docs | ||
ExactDiagonalization | ||
``` | ||
|
||
## `ExactDiagonalizationProblem` | ||
|
||
```@docs | ||
ExactDiagonalizationProblem | ||
solve(::ExactDiagonalizationProblem) | ||
init(::ExactDiagonalizationProblem) | ||
``` | ||
|
||
## Solver algorithms | ||
|
||
```@docs | ||
KrylovKitSolver | ||
LinearAlgebraSolver | ||
ArpackSolver | ||
LOBPCGSolver | ||
``` | ||
|
||
## Converting a Hamiltonian in to a matrix | ||
|
||
```@docs | ||
BasisSetRepresentation | ||
build_basis | ||
Matrix | ||
sparse | ||
``` | ||
|
||
## Deprecated | ||
```@docs | ||
BasisSetRep | ||
``` | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
module ArpackExt | ||
|
||
using Arpack: Arpack, eigs | ||
using CommonSolve: CommonSolve, solve | ||
using NamedTupleTools: delete | ||
using LinearAlgebra: norm | ||
|
||
using Rimu: Rimu, DVec, replace_keys | ||
using Rimu.ExactDiagonalization: ArpackSolver, MatrixEDSolver, | ||
LazyDVecs, EDResult | ||
|
||
struct ArpackConvergenceInfo | ||
converged::Int | ||
numiter::Int | ||
numops::Int | ||
residual::Vector{Float64} | ||
end | ||
function Base.show(io::IO, info::ArpackConvergenceInfo) | ||
print(io, "converged = $(info.converged), ") | ||
print(io, "numiter = $(info.numiter), ") | ||
print(io, "numops = $(info.numops), ") | ||
print(io, "residual norm = ") | ||
show(io, norm(info.residual)) | ||
end | ||
|
||
function CommonSolve.solve(s::S; kwargs... | ||
) where {S<:MatrixEDSolver{<:ArpackSolver}} | ||
# combine keyword arguments and set defaults for `howmany` and `which` | ||
kw_nt = (; howmany=1, which=:SR, s.kw_nt..., kwargs...) | ||
# check if universal keyword arguments are present | ||
kw_nt = replace_keys(kw_nt, (:abstol=>:tol, :maxiters=>:maxiter)) | ||
verbose = get(kw_nt, :verbose, false) | ||
kw_nt = delete(kw_nt, (:verbose,)) | ||
|
||
# Remove the `howmany` key from the kwargs. | ||
kw_nt = (; nev=kw_nt.howmany, kw_nt..., ritzvec=true) | ||
kw_nt = delete(kw_nt, (:howmany,)) | ||
howmany = kw_nt.nev | ||
|
||
# set up the starting vector | ||
v0 = if isnothing(s.v0) | ||
zeros((0,)) | ||
else | ||
# convert v0 to a DVec to use it like a dictionary | ||
dvec = DVec(s.v0) | ||
[dvec[a] for a in s.basissetrep.basis] | ||
end | ||
# solve the problem | ||
vals, vec_matrix, nconv, niter, nmult, resid = eigs(s.basissetrep.sparse_matrix; v0, kw_nt...) | ||
|
||
verbose && @info "Arpack.eigs: $nconv converged out of $howmany requested eigenvalues,"* | ||
" $niter iterations," * | ||
" $nmult matrix vector multiplications, norm of residual = $(norm(resid))" | ||
success = nconv ≥ howmany | ||
# vecs = [view(vec_matrix, :, i) for i in 1:length(vals)] # convert to array of vectors | ||
coefficient_vectors = eachcol(vec_matrix) | ||
vectors = LazyDVecs(coefficient_vectors, s.basissetrep.basis) | ||
info = ArpackConvergenceInfo(nconv, niter, nmult, resid) | ||
if !success | ||
@warn "Arpack.eigs did not converge for all requested eigenvalues:" * | ||
" $nconv converged out of $howmany requested value(s)." | ||
end | ||
return EDResult( | ||
s.algorithm, | ||
s.problem, | ||
vals, | ||
vectors, | ||
coefficient_vectors, | ||
s.basissetrep.basis, | ||
info, | ||
howmany, | ||
vec_matrix, | ||
success | ||
) | ||
end | ||
|
||
end # module |
Oops, something went wrong.