Skip to content

Commit

Permalink
Added tests for equality of Cartesian and direct coordinate POSCAR files
Browse files Browse the repository at this point in the history
  • Loading branch information
brainandforce committed Oct 11, 2023
1 parent 10d6106 commit e606bfc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/filetypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ end
contcar = readCONTCAR(tmpdir)
@test basis(contcar) basis(poscar)
@test contcar.atoms == sort(poscar).atoms
# Test that POSCARs for direct and Cartesian coordinates match up to floating point error
c = readPOSCAR("files/In3Ir_cartesian.vasp")
d = readPOSCAR("files/In3Ir_direct.vasp")
@test basis(c) === basis(d)
@test all(isapprox.(displacement.(c), displacement.(d), atol=sqrt(eps(Float64))))
end

@testset "LAMMPS position data" begin
# This is going to suffer from floating point errors/parsing differences
# This is going to suffer from large floating point errors/parsing differences
@test all(isapprox.(displacement.(lammps.atoms), displacement.(poscar.atoms), atol=1e-6))
@test isapprox(basis(lammps), basis(poscar), atol=1e-6 * Electrum.ANG2BOHR)
end
Expand Down

0 comments on commit e606bfc

Please sign in to comment.