diff --git a/test/external_pair.jl b/test/external_pair.jl index 9fb18ce..950d1cc 100644 --- a/test/external_pair.jl +++ b/test/external_pair.jl @@ -1,8 +1,8 @@ using LAMMPS using Test -lmp_native = LMP() -lmp_julia = LMP() +lmp_native = LMP(["-screen", "none"]) +lmp_julia = LMP(["-screen", "none"]) for lmp in (lmp_native, lmp_julia) command(lmp, "units lj") @@ -24,13 +24,13 @@ command(lmp_julia, "fix julia_lj all external pf/callback 1 1") command(lmp_native, "pair_style lj/cut $cutoff") command(lmp_native, "pair_coeff * * 1 1") -const coefficients = Dict( - 1 => Dict( - 1 => [48.0, 24.0, 4.0,4.0] +const coefficients = Base.ImmutableDict( + 1 => Base.ImmutableDict( + 1 => [48.0, 24.0, 4.0, 4.0] ) ) -function compute_force(rsq, itype, jtype) +@inline function compute_force(rsq, itype, jtype) coeff = coefficients[itype][jtype] r2inv = 1.0/rsq r6inv = r2inv^3 @@ -39,7 +39,7 @@ function compute_force(rsq, itype, jtype) return (r6inv * (lj1*r6inv - lj2))*r2inv end -function compute_energy(rsq, itype, jtype) +@inline function compute_energy(rsq, itype, jtype) coeff = coefficients[itype][jtype] r2inv = 1.0/rsq r6inv = r2inv^3 @@ -58,14 +58,14 @@ for lmp in (lmp_native, lmp_julia) command(lmp, "create_atoms 1 random $natoms 1 NULL") command(lmp, "mass 1 1.0") - LAMMPS.API.lammps_scatter_atoms(lmp, "x", 1, 3, positions) + scatter!(lmp, "x", positions) command(lmp, "run 0") end # extract forces -forces_native = extract_atom(lmp_native, "f") -forces_julia = extract_atom(lmp_julia, "f") +forces_native = gather(lmp_native, "f", Float64) +forces_julia = gather(lmp_julia, "f", Float64) @testset "External Pair" begin @test forces_native == forces_julia