From 97b44c23940aff5c26f55c07bec56349c3400f7f Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Sat, 16 Sep 2023 21:47:20 +0200 Subject: [PATCH 1/4] Disable printing for cells with negative vectors --- src/visualize_ascii.jl | 5 ++++- test/printing.jl | 32 ++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/visualize_ascii.jl b/src/visualize_ascii.jl index eb5990d..97f8263 100644 --- a/src/visualize_ascii.jl +++ b/src/visualize_ascii.jl @@ -16,11 +16,11 @@ function visualize_ascii(system::AbstractSystem{D}) where {D} cell = austrip.(reduce(hcat, bounding_box(system))) box = Vector(diag(cell)) shift = zero(box) + plot_box = D > 1 is_right_handed = det(cell) > 0 is_right_handed || return "" - plot_box = D > 1 is_orthorhombic = isdiag(cell) if !is_orthorhombic # Build an orthorhombic cell inscribing the actual unit cell @@ -34,6 +34,9 @@ function visualize_ascii(system::AbstractSystem{D}) where {D} plot_box = false end + # If one of the box coordinates is negative + any(box .≤ 0) && return "" + # Normalise positions normpos = [@. box * mod((shift + austrip(p)) / box, 1.0) for p in position(system)] diff --git a/test/printing.jl b/test/printing.jl index d3d21fa..2b5e509 100644 --- a/test/printing.jl +++ b/test/printing.jl @@ -24,15 +24,27 @@ using Test end @testset "Test ASCII representation of structures" begin - atoms = [:Si => [0.0, -0.125, 0.0], - :C => [0.125, 0.0, 0.0]] - box = [[10, 0.0, 0.0], [0.0, 5, 0.0], [0.0, 0.0, 7]]u"Å" - system = periodic_system(atoms, box; fractional=true) - println(visualize_ascii(system)) + @testset "3D standard system" begin + atoms = [:Si => [0.0, -0.125, 0.0], + :C => [0.125, 0.0, 0.0]] + box = [[10, 0.0, 0.0], [0.0, 5, 0.0], [0.0, 0.0, 7]]u"Å" + system = periodic_system(atoms, box; fractional=true) + println(visualize_ascii(system)) + end + + @testset "2D standard system" begin + atoms = [:Si => [0.0, -0.125], + :C => [0.125, 0.0]] + box = [[10, 0.0], [0.0, 5]]u"Å" + system = periodic_system(atoms, box; fractional=true) + println(visualize_ascii(system)) + end - atoms = [:Si => [0.0, -0.125], - :C => [0.125, 0.0]] - box = [[10, 0.0], [0.0, 5]]u"Å" - system = periodic_system(atoms, box; fractional=true) - println(visualize_ascii(system)) + @testset "3D with negative unit cell" begin + atoms = [:Si => [0.75, 0.75, 0.75], + :Si => [0.0, 0.0, 0.0]] + box = [[-2.73, -2.73, 0.0], [-2.73, 0.0, -2.73], [0.0, -2.73, -2.73]]u"Å" + system = periodic_system(atoms, box; fractional=true) + println(visualize_ascii(system)) + end end From 0594c0f91adcdb8befd303215da2a83f4979dacc Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Sat, 16 Sep 2023 21:51:39 +0200 Subject: [PATCH 2/4] Bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 2c9eaaa..570f1a3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AtomsBase" uuid = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a" authors = ["JuliaMolSim community"] -version = "0.3.4" +version = "0.3.5" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" From c61959666175d0ae43d0213901fc42fd4be1561f Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Sat, 16 Sep 2023 22:00:00 +0200 Subject: [PATCH 3/4] Documenter update --- docs/make.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index bdfb885..0200611 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -22,7 +22,6 @@ makedocs(; "apireference.md" ], checkdocs=:exports, - strict=true, ) deploydocs(; From 62c9967c0488a1bb2a0f25d9331d50b2eeeee911 Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Sat, 16 Sep 2023 22:14:28 +0200 Subject: [PATCH 4/4] up --- docs/make.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index 0200611..82ee498 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -6,7 +6,6 @@ DocMeta.setdocmeta!(AtomsBase, :DocTestSetup, :(using AtomsBase); recursive=true makedocs(; modules=[AtomsBase], authors="JuliaMolSim community", - repo="https://github.com/JuliaMolSim/AtomsBase.jl/blob/{commit}{path}#{line}", sitename="AtomsBase.jl", format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true",