Skip to content

Commit

Permalink
export GramSchmidt
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimbrand committed May 16, 2024
1 parent 7b3f4a1 commit a5b0479
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Rimu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export TimeStepStrategy, ConstantTimeStep, OvershootControl
export localpart, walkernumber
export smart_logger, default_logger
export ProjectorMonteCarloProblem, SimulationPlan, StateVectors
export FCIQMC, num_replicas, num_spectral_states
export FCIQMC, num_replicas, num_spectral_states, GramSchmidt

function __init__()
# Turn on smart logging once at runtime. Turn off with `default_logger()`.
Expand Down
2 changes: 2 additions & 0 deletions src/lomc.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file contains deprecated code. This code will be removed in a future release.

"""
lomc!(ham::AbstractHamiltonian, [v]; kwargs...) -> df, state
lomc!(state::ReplicaState, [df]; kwargs...) -> df, state
Expand Down
6 changes: 5 additions & 1 deletion src/strategies_and_params/spectralstrategy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ Use the Gram-Schmidt procedure to orthogonalize the excited states. A total of `
states are used in the simulation.
"""
struct GramSchmidt{S} <: SpectralStrategy{S} end
GramSchmidt(num_spectral_states = 1) = GramSchmidt{num_spectral_states}()

function GramSchmidt(num_spectral_states = 1)
num_spectral_states > 1 && throw(ArgumentError("num_spectral_states > 1 is currently not supported."))
GramSchmidt{num_spectral_states}()
end
2 changes: 1 addition & 1 deletion test/Interfaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ end
@test eigs.values[1] last_shift rtol = 0.01
@test df.shift[end] eigs.values[1] rtol=0.01
@test df.hproj[end] / df.vproj[end] eigs.values[1] rtol=0.01
@test normalize(state_vectors(sm)[1]) DVec(pairs(eigs.vectors[:, 1])) rtol = 0.01
@test normalize(StateVectors(sm)[1]) DVec(pairs(eigs.vectors[:, 1])) rtol = 0.01
end
3 changes: 0 additions & 3 deletions test/lomc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,17 @@ Random.seed!(1234)
@test state.spectral_states[1].single_states[1].pv !== v
@test state.spectral_states[1].single_states[1].pv !== wm

# @set state.simulation_plan.last_step = 10
df = lomc!(state, df, laststep=10).df
@test_broken state.spectral_states[1].single_states[1].v === wm
@test state.spectral_states[1].single_states[1].pv === v

@test size(df, 1) == 10
@test state.step[] == 10

# @set state.simulation_plan.last_step = 100
df, state = lomc!(state, df, laststep=100)
@test size(df, 1) == 100

state.step[] = 0
# state = @set state.simulation_plan.starting_step = 0
df, state = lomc!(state, df)
@test size(df, 1) == 200
@test df.steps == [1:100; 1:100]
Expand Down

0 comments on commit a5b0479

Please sign in to comment.