• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

joachimbrand / Rimu.jl / 11740435665

08 Nov 2024 10:29AM UTC coverage: 94.334% (+0.02%) from 94.31%
11740435665

Pull #290

github

joachimbrand
typo in docstring
Pull Request #290: Adaptive Time Step

55 of 56 new or added lines in 6 files covered. (98.21%)

1 existing line in 1 file now uncovered.

6993 of 7413 relevant lines covered (94.33%)

13407004.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/strategies_and_params/timestepstrategy.jl
1
"""
2
    TimeStepStrategy
3

4
Abstract type for strategies for updating the time step with
5
[`update_time_step()`](@ref). Implemented strategies:
6

7
* [`ConstantTimeStep`](@ref)
8
* [`AdaptiveTimeStep`](@ref)
9

10
See also [`FCIQMC`](@ref).
11
"""
12
abstract type TimeStepStrategy end
13

14
"""
15
    ConstantTimeStep() <: TimeStepStrategy
16

17
Keep the `time_step` constant.
18

19
See also [`TimeStepStrategy`](@ref), [`FCIQMC`](@ref).
20
"""
21
struct ConstantTimeStep <: TimeStepStrategy end
348✔
22

23
"""
24
    update_time_step(s<:TimeStepStrategy, time_step, deaths, clones, zombies, tnorm, len)
25
    -> new_time_step
26
Update the time step according to the strategy `s`.
27

28
See also [`TimeStepStrategy`](@ref).
29
"""
30
update_time_step(::ConstantTimeStep, time_step, args...) = time_step
683,751✔
31

32
"""
33
    AdaptiveTimeStep(; damp_zombies=0.9, grow=1.01) <: TimeStepStrategy
34

35
Adapt the time step to avoid zombies.
36

37
## Parameters
38
* `damp_zombies`: factor by which to decrease the time step for each zombie.
39
* `grow`: factor by which to increase the time step when there are no zombies.
40

41
See also [`TimeStepStrategy`](@ref), [`FCIQMC`](@ref).
42
"""
43
struct AdaptiveTimeStep <: TimeStepStrategy
44
    damp_zombies::Float64
1✔
45
    grow::Float64
46
end
47
function AdaptiveTimeStep(; damp_zombies=0.9, grow=1.01)
2✔
48
    return AdaptiveTimeStep(damp_zombies, grow)
1✔
49
end
50

51
function update_time_step(s::AdaptiveTimeStep, time_step, _, _, zombies, _...)
100✔
52
    if  zombies > 0
100✔
NEW
53
        return time_step * s.damp_zombies^zombies # decrease time step
×
54
    else
55
        return time_step * s.grow # increase time step
100✔
56
    end
57
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc