Skip to content

Commit e8da440

Browse files
Merge pull request #25 from SebastianM-C/show
Show accepted timesteps
2 parents 21f6ae3 + 1865d8e commit e8da440

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/nbody_simulation_result.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function Base.show(stream::IO, sr::SimulationResult)
1111
println(stream)
1212
show(stream, sr.simulation)
1313
print(stream, "Time steps: ")
14-
show(stream, length(sr.solution.t))
14+
show(stream, sr.solution.destats.naccept)
1515
println(stream)
1616
print(stream, "t: ", minimum(sr.solution.t), ", ", maximum(sr.solution.t))
1717
println(stream)

test/lennard_jones_test.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
@test v_expected v_actual atol = ε
2929

3030
io = IOBuffer()
31-
32-
@test sprint(io -> show(io, system)) ==
31+
32+
@test sprint(io -> show(io, system)) ==
3333
"Potentials: \nLennard-Jones:\n\tϵ:1.0\n\tσ:1.0\n\tR:Inf\n"
3434

35-
@test sprint(io -> show(io, simulation)) ==
35+
@test sprint(io -> show(io, simulation)) ==
3636
"Timespan: (0.0, 1.0)\nBoundary conditions: InfiniteBox{Float64}([-Inf, Inf, -Inf, Inf, -Inf, Inf])\nPotentials: \nLennard-Jones:\n\tϵ:1.0\n\tσ:1.0\n\tR:Inf\n"
3737

38-
@test sprint(io -> show(io, sim_result)) ==
39-
"N: 2\nTimespan: (0.0, 1.0)\nBoundary conditions: InfiniteBox{Float64}([-Inf, Inf, -Inf, Inf, -Inf, Inf])\nPotentials: \nLennard-Jones:\n\tϵ:1.0\n\tσ:1.0\n\tR:Inf\nTime steps: 1001\nt: 0.0, 1.0\n"
38+
@test sprint(io -> show(io, sim_result)) ==
39+
"N: 2\nTimespan: (0.0, 1.0)\nBoundary conditions: InfiniteBox{Float64}([-Inf, Inf, -Inf, Inf, -Inf, Inf])\nPotentials: \nLennard-Jones:\n\tϵ:1.0\n\tσ:1.0\n\tR:Inf\nTime steps: 1000\nt: 0.0, 1.0\n"
4040
end
4141

42-
@testset "Three particles of liquid argon and their \"temperature\"" begin
42+
@testset "Three particles of liquid argon and their \"temperature\"" begin
4343
T = 120.0 # °K
4444
kb = 8.3144598e-3 # kJ/(K*mol)
4545
ϵ = T * kb
@@ -48,7 +48,7 @@
4848
m = 39.95# Da
4949
L = 5σ # 10.229σ
5050
N = 3 # floor(Int, ρ * L^3 / m)
51-
R = 2.25σ
51+
R = 2.25σ
5252
v_dev = sqrt(3 * kb * T / m)
5353
r1 = SVector(L / 3, L / 3, 2 * L / 3)
5454
r2 = SVector(L / 3, 2 * L / 3, L / 3)
@@ -69,7 +69,7 @@
6969
simulation = NBodySimulation(lj_system, (t1, t2), PeriodicBoundaryConditions(L), kb);
7070
result = run_simulation(simulation, VelocityVerlet(), dt=τ)
7171

72-
T1 = temperature(result, t1)
72+
T1 = temperature(result, t1)
7373
ε = 1e-6
7474
@test T1 120.0 atol = ε
7575

@@ -110,7 +110,7 @@
110110

111111
end
112112

113-
@testset "Testing RDF and MSD calculation" begin
113+
@testset "Testing RDF and MSD calculation" begin
114114
T = 120.0 # °K
115115
kb = 8.3144598e-3 # kJ/(K*mol)
116116
ϵ = T * kb
@@ -119,7 +119,7 @@
119119
m = 39.95# Da
120120
L = 5σ # 10.229σ
121121
N = 125 # floor(Int, ρ * L^3 / m)
122-
R = 0.5L
122+
R = 0.5L
123123
τ = 0.5e-3 # ps or 1e-12 s
124124
t1 = 0.0
125125
t2 = 400τ
@@ -146,7 +146,7 @@
146146
@test 2.5 == default_potential.R
147147
@test 1.0 == default_potential.σ2
148148
@test 6.25 == default_potential.R2
149-
149+
150150
io = IOBuffer()
151151
potential1 = LennardJonesParameters()
152152
potential2 = LennardJonesParameters(2, 5, 10)
@@ -166,4 +166,4 @@
166166
@test boundary[i] == pbc[i]
167167
end
168168
end
169-
end
169+
end

0 commit comments

Comments
 (0)