Skip to content

Commit ea11f8a

Browse files
added test for Langevin thermostating in water
1 parent db352b2 commit ea11f8a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using NBodySimulator, StaticArrays, LinearAlgebra
1+
using NBodySimulator, StaticArrays, LinearAlgebra, StochasticDiffEq
22
using Test
33

44
include("lennard_jones_test.jl")

test/thermostat_test.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using StochasticDiffEq
2-
31
@testset "Testing thermostats on liquid argon " begin
42
T = 120.0 # °K
53
T0 = 90 # °K

test/water_test.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,22 @@
111111
@test γind == 19
112112
end
113113

114+
@testset "Water thermostating" begin
115+
ττ = 0.5e-4 # ps
116+
t1 = 0ττ
117+
t2 = 200ττ
118+
T0 = 275
119+
bodies = generate_bodies_in_cell_nodes(N, mH2O, v_dev, L)
120+
water = WaterSPCFw(bodies, mH, mO, qH, qO, jl_parameters, e_parameters, spc_paramters);
121+
thermostat = LangevinThermostat(T0, 100)
122+
simulation = NBodySimulation(water, (t1, t2), pbc, thermostat, kb)
123+
result = run_simulation(simulation, EM(), dt=τ)
124+
125+
T2 = temperature(result, t2)
126+
ε = 1.0
127+
@test abs(T2 - T0) / T0 0.0 atol = ε
128+
end
129+
114130
@testset "Protein Data Bank file compilation" begin
115131
t1 = 0τ
116132
t2 = 2τ

0 commit comments

Comments
 (0)