From 3361ed79376b994798a54d197196a3cec8955464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teemu=20J=C3=A4rvinen?= Date: Thu, 21 Nov 2024 17:08:18 +0200 Subject: [PATCH] AB v0.5 update --- Project.toml | 8 ++++---- src/utils.jl | 14 +++++++------- test/test_bulk.jl | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Project.toml b/Project.toml index 6eef91d..1c1fbe4 100644 --- a/Project.toml +++ b/Project.toml @@ -11,13 +11,13 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] -AtomsBase = "0.4" +AtomsBase = "0.5" JSON = "0.21.4" -LinearAlgebra = "1.9.0, 1.10.0" -Random = "1.9.0, 1.10.0" +LinearAlgebra = "1.9" +Random = "1.9" StaticArrays = "1.9" Unitful = "1.19" -julia = "1.9.0, 1.10.0" +julia = "1.9" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/src/utils.jl b/src/utils.jl index 53ca5e7..4530529 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -20,7 +20,7 @@ function _flexible_system(positions, elements, cell, pbc) bc = pbc isa Bool ? (pbc, pbc, pbc) : tuple(pbc...) bb = tuple([cell[i, :] for i = 1:3]...) return FlexibleSystem(atoms; - bounding_box = bb, + cell_vectors = bb, periodicity = bc) end @@ -38,7 +38,7 @@ function set_positions(at::FlexibleSystem, particles = [ _set_position(at.particles[i], X[i]) for i in 1:length(at) ] return FlexibleSystem(particles, - bounding_box = bounding_box(at), + cell_vectors = cell_vectors(at), periodicity = periodicity(at)) end @@ -48,7 +48,7 @@ function set_elements(at::FlexibleSystem, Z::AbstractVector) particles = [ Atom(Z[i], position(x), velocity(x)) for (i, x) in enumerate(at.particles) ] return FlexibleSystem(particles, - bounding_box = bounding_box(at), + cell_vectors = cell_vectors(at), periodicity = periodicity(at)) end @@ -72,7 +72,7 @@ at = bulk(:) * (3, 2, 4) ``` """ function Base.repeat(at::FlexibleSystem, n::NTuple{3}) - c1, c2, c3 = bounding_box(at) + c1, c2, c3 = cell_vectors(at) particles = eltype(at.particles)[] for a in CartesianIndices( (1:n[1], 1:n[2], 1:n[3]) ) @@ -85,7 +85,7 @@ function Base.repeat(at::FlexibleSystem, n::NTuple{3}) end bb = (c1 * n[1], c2 * n[2], c3 * n[3]) - return FlexibleSystem(particles; bounding_box = bb, + return FlexibleSystem(particles; cell_vectors = bb, periodicity = periodicity(at)) end @@ -173,9 +173,9 @@ takes the union of two particle systems provided their cells are identical. """ function union(sys1::FlexibleSystem, sys2::FlexibleSystem) @assert periodicity(sys1) == periodicity(sys2) - @assert bounding_box(sys1) == bounding_box(sys2) + @assert cell_vectors(sys1) == cell_vectors(sys2) return FlexibleSystem(union(sys1.particles, sys2.particles), - bounding_box = bounding_box(at), + cell_vectors = cell_vectors(at), periodicit = periodicity(at) ) end diff --git a/test/test_bulk.jl b/test/test_bulk.jl index 0f8e661..5e416ce 100644 --- a/test/test_bulk.jl +++ b/test/test_bulk.jl @@ -12,7 +12,7 @@ test_systems = JSON.parsefile(joinpath(@__DIR__(), "..", "data", "test_systems.j _ustripvecvec(X) = [ ustrip.(x) for x in X ] compare_system(sys_f, sys_j) = ( - all( ustrip.( hcat(bounding_box(sys_f)...) ) .≈ hcat(sys_j["cell"]...)' ) && + all( ustrip.( hcat(cell_vectors(sys_f)...) ) .≈ hcat(sys_j["cell"]...)' ) && all( AtomsBuilder._convert_pbc(sys_j["pbc"]) .== periodicity(sys_f) ) && all( atomic_number(sys_f, :) .== sys_j["Z"] ) && all( _ustripvecvec(position(sys_f, :)) .≈ sys_j["X"] ) )