1- @testset " Testing thermostats on liquid argon " begin
1+ @testset " Testing thermostats on liquid argon " begin
22 T = 120.0 # °K
33 T0 = 90 # °K
44 kb = 8.3144598e-3 # kJ/(K*mol)
88 m = 39.95 # Da
99 N = 125
1010 L = (m * N / ρ)^ (1 / 3 )# 10.229σ
11- R = 0.5 * L
11+ R = 0.5 * L
1212 v_dev = sqrt (kb * T / m)
13- @testset " Andersen thermostat" begin
13+ @testset " Andersen thermostat" begin
1414 bodies = generate_bodies_in_cell_nodes (N, m, v_dev, L)
1515
1616 τ = 0.5e-3 # ps or 1e-12 s
2222 thermostat = AndersenThermostat (T0, 0.1 / τ)
2323 simulation = NBodySimulation (lj_system, (t1, t2), PeriodicBoundaryConditions (L), thermostat, kb);
2424 result = run_simulation (simulation, VelocityVerlet (), dt= τ)
25-
2625
27- T1 = temperature (result, t1)
26+
27+ T1 = temperature (result, t1)
2828 T2 = temperature (result, t2)
2929 ε = 0.5
3030 @test abs (T2 - T0) / T0 ≈ 0.0 atol = ε
31+ @test result. solution. t == unique (result. solution. t)
3132 end
3233
33- @testset " Berendsen thermostat" begin
34+ @testset " Berendsen thermostat" begin
3435 bodies = generate_bodies_in_cell_nodes (N, m, v_dev, L)
3536
3637 τ = 0.5e-3
4344 pbc = CubicPeriodicBoundaryConditions (L)
4445 simulation = NBodySimulation (lj_system, (t1, t2), pbc, thermostat, kb);
4546 result = run_simulation (simulation, VelocityVerlet (), dt= τ)
46-
47+
4748 T2 = temperature (result, t2)
4849 ε = 0.1
4950 @test abs (T2 - T0) / T ≈ 0.0 atol = ε
5051 end
5152
52- @testset " Nose-Hoover thermostat" begin
53+ @testset " Nose-Hoover thermostat" begin
5354 bodies = generate_bodies_in_cell_nodes (N, m, v_dev, L)
5455
5556 τ = 0.5e-3
6263 pbc = CubicPeriodicBoundaryConditions (L)
6364 simulation = NBodySimulation (lj_system, (t1, t2), pbc, thermostat, kb);
6465 result = run_simulation (simulation, VelocityVerlet (), dt= τ)
65-
66+
6667 T2 = temperature (result, t2)
6768 ε = 0.5
6869 @test abs (T2 - T0) / T0 ≈ 0.0 atol = ε
6970 end
7071
71- @testset " Langevin thermostat" begin
72+ @testset " Langevin thermostat" begin
7273 bodies = generate_bodies_in_cell_nodes (N, m, v_dev, L)
7374
7475 τ = 0.5e-3
8182 pbc = CubicPeriodicBoundaryConditions (L)
8283 simulation = NBodySimulation (lj_system, (t1, t2), pbc, thermostat, kb);
8384 result = run_simulation (simulation, EM (), dt= τ)
84-
85+
8586 T2 = temperature (result, t2)
8687 ε = 0.5
8788 @test abs (T2 - T0) / T0 ≈ 0.0 atol = ε
8889 end
89- end
90+ end
0 commit comments