Skip to content

Commit

Permalink
Rename non-periodic into 0-dimensional
Browse files Browse the repository at this point in the history
  • Loading branch information
Liozou committed Apr 16, 2024
1 parent f7079a3 commit 6ba3149
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Note that `Auto` is equivalent to both `AllNodes` and `SingleNodes` when the [`S

See [below](@ref ToposProStandard) for the reason why the `Standard` topology is **xbi** and not ToposPro's "3,4,8T15".

## CrystalNets.jl incorrectly detects bonds or reports a periodic structure as "non-periodic"
## CrystalNets.jl incorrectly detects bonds or reports a periodic structure as "0-dimensional"

You can use the [Visualization](@ref) tutorial to identify which bonds are incorrectly
detected or missing.
Expand Down
2 changes: 1 addition & 1 deletion src/archive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function make_archive(path, destination, verbose=false)
for (i, (topology, nfold)) in enumerate(results)
nfold == 0 && continue
genome = string(topology)
if startswith(genome, "unstable") || genome == "non-periodic"
if startswith(genome, "unstable") || genome == "0-dimensional"
flag = true
push!(flagerror[]::Vector{Tuple{Vector{Int},String}}, (vmap, genome))
continue
Expand Down
2 changes: 1 addition & 1 deletion src/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ using PrecompileTools
# sfv = topological_genome(CrystalNet(PeriodicGraph(REVERSE_CRYSTALNETS_ARCHIVE["*SFV"])))
# 2D
hcb = topological_genome(CrystalNet(PeriodicGraph(REVERSE_CRYSTALNETS_ARCHIVE["hcb"])))
# non-periodic
# 0-dimensional
calfig = determine_topology(path_to_calfig; structure=StructureType.MOF, clusterings=[Clustering.Auto])
# other calls to determine_topology
determine_topology(path_to_abw; structure=StructureType.Zeolite)
Expand Down
4 changes: 2 additions & 2 deletions src/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ Return a dictionary linking each file name to the result.
The result is the corresponding topology name, if known, or the topological
genome preceded by an "UNKNOWN" mention otherwise. In case of error, the result
is the exception preceded by a "FAILED with" mention. Finally, if the input does
not represent a periodic structure, the result is "non-periodic".
not represent a periodic structure, the result is "0-dimensional".
It is strongly recommended to toggle warnings off (through [`toggle_warning`](@ref)) and
not to export any file since those actions may critically reduce performance,
Expand Down Expand Up @@ -654,7 +654,7 @@ function export_report(path, results::Dict; keepext=true, fullunknown=false, clu
elseif !isempty(topo.error)
print(io, "ERROR")
elseif ndims(topo.genome) == 0
print(io, "non-periodic")
print(io, "0-dimensional")
elseif topo.unstable
print(io, "UNSTABLE")
elseif topo.name isa Nothing
Expand Down
10 changes: 5 additions & 5 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ function Base.show(io::IO, x::TopologicalGenome)
if !isempty(x.error)
print(io, "FAILED with: ", x.error)
elseif ndims(x.genome) == 0
print(io, "non-periodic")
print(io, "0-dimensional")
elseif x.unstable
print(io, "unstable ", x.genome)
elseif x.name isa String
Expand All @@ -1034,7 +1034,7 @@ function Base.parse(::Type{TopologicalGenome}, s::AbstractString)
if startswith(s, "UNKNOWN")
return TopologicalGenome(PeriodicGraph(s[9:end]), nothing, false)
end
s == "non-periodic" && return TopologicalGenome()
s == "0-dimensional" && return TopologicalGenome()
if startswith(s, "unstable")
return TopologicalGenome(PeriodicGraph(s[10:end]), nothing, true)
end
Expand Down Expand Up @@ -1371,7 +1371,7 @@ struct InterpenetratedTopologyResult <: AbstractVector{Tuple{TopologyResult,Int}
data::Vector{Tuple{TopologyResult,Int,Vector{Int}}}
end
function InterpenetratedTopologyResult(b::Bool)
if b # non-periodic
if b # 0-dimensional
InterpenetratedTopologyResult([(TopologyResult(),0,Int[])])
else # no topology computation
InterpenetratedTopologyResult(Tuple{TopologyResult,Int,Vector{Int}}[])
Expand All @@ -1390,7 +1390,7 @@ function Base.show(io::IO, ::MIME"text/plain", x::InterpenetratedTopologyResult)
end
for (i, (topology, nfold)) in enumerate(x)
if nfold == 0
print(io, "non-periodic")
print(io, "0-dimensional")
continue
end
if compact
Expand Down Expand Up @@ -1422,7 +1422,7 @@ end

function Base.parse(::Type{InterpenetratedTopologyResult}, x::AbstractString)
s = split(x; limit=4)
length(s) == 1 && x == "non-periodic" && return InterpenetratedTopologyResult(true)
length(s) == 1 && x == "0-dimensional" && return InterpenetratedTopologyResult(true)
isempty(s) && return InterpenetratedTopologyResult(false)
if length(s) > 3 && s[2] == "interpenetrated" && s[3] == "substructures:"
lines = split(s[4], '\n')
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ import CrystalNets.Clustering: SingleNodes, AllNodes, Standard, PE, PEM
fowwar = extract1(determine_topology(joinpath(cifs, "FOWWAR.cif"); kwargs..., bonding=Bonding.Input, clusterings=[Clustering.Standard]))
@test string(fowwar) == "Standard: UNKNOWN 3 1 1 0 0 1 1 2 0 0 0 1 3 0 0 0 1 4 0 0 0 2 5 0 0 0 2 6 0 0 0 3 6 0 0 0 3 7 0 0 0 4 5 1 0 0 4 7 0 -1 0 5 5 0 1 1 5 8 0 0 0 6 6 0 0 1 6 8 0 1 0 7 7 0 1 1 7 8 1 1 0"

# Test non-periodic input
# Test 0-dimensional input
calfig = extract1(determine_topology(joinpath(cifs, "CALFIG.cif"); kwargs..., clusterings=[Clustering.Auto]))
@test string(calfig) == "non-periodic"
@test string(calfig) == "0-dimensional"

println(stderr, "The following @error about carbon cycle disorder is expected.")
# Test carbon cycle disorder detection
Expand Down

0 comments on commit 6ba3149

Please sign in to comment.