From 4ba72f4ff46a4fb4e0a35ee9b6f221b0c28291bc Mon Sep 17 00:00:00 2001 From: Lionel Zoubritzky Date: Mon, 28 Oct 2024 12:10:07 +0100 Subject: [PATCH] Use split_catenation instead of dimensionality to properly separate catenated nets --- .github/workflows/documentation.yml | 2 +- Project.toml | 4 +- src/minimization.jl | 2 +- src/query.jl | 2 +- src/types.jl | 117 +++++++++++------ test/cif/MOFs/AFIXEW_ASR.cif | 188 ++++++++++++++++++++++++++++ test/runtests.jl | 8 +- 7 files changed, 278 insertions(+), 45 deletions(-) create mode 100644 test/cif/MOFs/AFIXEW_ASR.cif diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index dbc6880..d9e6b77 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@latest with: - version: '1.10' + version: '1.11' - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy diff --git a/Project.toml b/Project.toml index e2fe337..c219074 100644 --- a/Project.toml +++ b/Project.toml @@ -25,9 +25,9 @@ Chemfiles = "0.10" Graphs = "1.3" LinearAlgebra = "1.6" Logging = "1.6" -PeriodicGraphEmbeddings = "0.3.0" +PeriodicGraphEmbeddings = "0.3.2" PeriodicGraphEquilibriumPlacement = "0.2" -PeriodicGraphs = "0.10" +PeriodicGraphs = "0.10.2" Pkg = "1.6" PrecompileTools = "1" ProgressMeter = "1.7" diff --git a/src/minimization.jl b/src/minimization.jl index 61a0623..bf7215b 100644 --- a/src/minimization.jl +++ b/src/minimization.jl @@ -284,7 +284,7 @@ function reduce_with_matrix(c::CrystalNet{D,Rational{T}}, mat, collisions) where for newnode in newcollisions if !allunique(newnode.neighs) # contravenes rule B of collision_nodes(::CrystalNet)) - return c, UnitRange{Int}[] + return c, CollisionList(UnitRange{Int}[]) end end diff --git a/src/query.jl b/src/query.jl index edcc74c..119a997 100644 --- a/src/query.jl +++ b/src/query.jl @@ -25,7 +25,7 @@ function topological_genome(net::CrystalNet{D,T})::TopologicalGenome where {D,T} flag = true try shrunk_net, newcollisions = minimize(shrunk_net, collisions) - if !(collisions isa CollisionList) && newcollisions isa CollisionList + if newcollisions isa CollisionList && (!(collisions isa CollisionList) || (isempty(newcollisions.list) && !isempty(collisions.list))) return TopologicalGenome(net.pge.g, nothing, true) end collisions = newcollisions diff --git a/src/types.jl b/src/types.jl index 875c3a5..612e680 100644 --- a/src/types.jl +++ b/src/types.jl @@ -464,9 +464,8 @@ function Crystal(pge, types, clusters, options) end return Crystal{Clusters}(pge, types, clusters, options) end -function Crystal(c::Crystal; kwargs...) - return Crystal(c.pge, c.types, c.clusters, Options(c.options; kwargs...)) -end +Crystal(c::Crystal, options) = Crystal(c.pge, c.types, c.clusters, options) +Crystal(c::Crystal; kwargs...) = Crystal(c, Options(c.options; kwargs...)) function ==(c1::Crystal{T}, c2::Crystal{T}) where T c1.pge == c2.pge && c1.types == c2.types && c1.clusters == c2.clusters && c1.options == c2.options @@ -714,22 +713,53 @@ function PeriodicGraphs.make_supercell(net::CrystalNet{N,T}, t) where {N,T} return CrystalNet{N,T}(pge, newtypes, Options(net.options; _pos=SVector{3,Float64}[])) end +function skew_crystal(c::Crystal{T}, pvmap, subpge, mat) where T + vmap = first.(pvmap) + types = c.types[vmap] + invmat = inv(Rational{Int}.(mat)) + clusters = if T <: Clusters + newclusters = c.clusters[vmap] + @toggleassert length(newclusters.offsets) == length(pvmap) + for (i, (clustofs, (_, skewofs))) in enumerate(zip(newclusters.offsets, pvmap)) + Δofs = clustofs .- skewofs + newclusters.offsets[i] = Int.(invmat * Δofs) + end + for sbu in newclusters.sbus + for (j, (v, _)) in enumerate(sbu) + sbu[j] = PeriodicVertex3D(v, newclusters.offsets[v]) + end + end + newclusters + else + nothing + end + posofs = invmat * pvmap.ofs + newpge = PeriodicGraphEmbedding3D(subpge.g, [pos + posofs for pos in subpge.pos], subpge.cell) + Crystal(newpge, types, clusters, c.options) +end + +# separate the different connex composants of the crystal function separate_components(c::Crystal{T}) where T - graph = PeriodicGraph3D(c.pge.g) - dimensions = PeriodicGraphs.dimensionality(graph) - @ifwarn if haskey(dimensions, 0) - _n0 = length(dimensions[0]) - _s, _it = _n0 > 1 ? ("s", "They") : ("", "It") - @warn lazy"Detected $_n0 structure$_s of dimension 0 in $(c.options.name), possibly complex solvent residue$_s. $_it will be ignored for topology computation." - end - ret = (Tuple{Crystal{T},Int,Vector{Int}}[], Tuple{Crystal{T},Int,Vector{Int}}[], Tuple{Crystal{T},Int,Vector{Int}}[]) - for i in 1:3 - reti = ret[i] - for (vmap, nfold) in get(dimensions, i, Vector{Int}[]) - push!(reti, (c[vmap], nfold, vmap)) + splits = split_catenation(c.pge) + numdim0 = 0 + num = 0 + ret = ntuple(_ -> Tuple{Vector{Crystal{T}},Vector{Int}}[], Val(3)) + for (subpge, pvmaps, mat, dim) in splits + if dim == 0 + numdim0 += 1 + else + num += 1 + num > 1 && c.options.track_mapping isa Vector{Int} && c.options.keep_single_track && throw(ArgumentError("Cannot keep a single mapping track for multiple sub-nets. Please use keep_single_track=true only on single components with a single clustering.")) + newc = Crystal(c, rev_permute_mapping!(c.options, first.(first(pvmaps)), length(c.types))) + crystals = [skew_crystal(newc, pvmap, subpge, mat) for pvmap in pvmaps] + push!(ret[dim], (crystals, first.(first(pvmaps)))) end end - return ret + @ifwarn if numdim0 > 0 + _s, _it = numdim0 > 1 ? ("s", "They") : ("", "It") + @warn lazy"Detected $numdim0 structure$_s of dimension 0 in $(c.options.name), possibly complex solvent residue$_s. $_it will be ignored for topology computation." + end + ret end @@ -841,13 +871,13 @@ end macro repeatgroups(ex) exs = [deepcopy(ex) for _ in 1:3] - for i in 1:3 + for i in 3:-1:1 _repeatgroups!(exs[i], i) end return quote - $(esc(exs[1])) - $(esc(exs[2])) $(esc(exs[3])) + $(esc(exs[2])) + $(esc(exs[1])) end end @@ -860,13 +890,21 @@ function UnderlyingNets(c::Crystal) push!(groups.D3, (nets, 1, vmap)) return groups end + i = 0 @repeatgroups begin - for (i, (comp, nfold, vmap)) in enumerate(components[D]) - component = Crystal(comp.pge, comp.types, comp.clusters, - Options(comp.options; name=string(comp.options.name,'_',i))) - crystals = collapse_clusters(component) - nets = collect_nets(crystals, Val(D)) - push!(groups, (nets, nfold, vmap)) + for (comps, vmap) in components[D] + i += 1 + has_export = !(isempty(c.options.export_trimmed) & + isempty(c.options.export_subnets) & + isempty(c.options.export_attributions) & + isempty(c.options.export_clusters)) + for (j, comp) in enumerate(has_export ? comps : (first(comps),)) + nameext = has_export && length(comps) > 1 ? "_fold$j" : "" + component = Crystal(comp; name=string(comp.options.name, '_', i, nameext)) + crystals = collapse_clusters(component) + nets = collect_nets(crystals, Val(D)) + j == 1 && push!(groups, (nets, length(comps), vmap)) + end end end return groups @@ -918,28 +956,31 @@ end const SmallPseudoGraph = Union{PseudoGraph{1},PseudoGraph{2},PseudoGraph{3}} function UnderlyingNets(g::SmallPseudoGraph, options::Options) - groups = UnderlyingNets() graph = g isa PeriodicGraph ? g : PeriodicGraph(g) - dimensions = PeriodicGraphs.dimensionality(graph) - @iferror if haskey(dimensions, 0) - _n0 = length(dimensions[0]) - _s, _it = _n0 > 1 ? ("s", "They") : ("", "It") - @error lazy"Detected $_n0 substructure$_s of dimension 0 in the input graph. $_it will be ignored for topology computation." - end + groups = UnderlyingNets() + splits = split_catenation(graph) cell = Cell() num = 0 - @repeatgroups begin - for (vmap, nfold) in get(dimensions, D, Vector{Int}[]) - nets = PeriodicGraph{D}(graph[vmap]) - n = nv(nets) + numdim0 = 0 + for (subg, pvmaps, _, D) in splits + if D == 0 + numdim0 += 1 + else + n = nv(subg) types = fill(Symbol(""), n) num += 1 num > 1 && options.track_mapping isa Vector{Int} && options.keep_single_track && throw(ArgumentError("Cannot keep a single mapping track for multiple sub-nets. Please use keep_single_track=true only on single components with a single clustering.")) + vmap = first.(first(pvmaps)) opts = rev_permute_mapping!(options, vmap, n) - push!(groups, (CrystalNet{D}[CrystalNet{D}(cell, types, nets, opts)], nfold, vmap)) + gD = D == 1 ? groups.D1 : D == 2 ? groups.D2 : groups.D3 + push!(gD, (CrystalNet{D}[CrystalNet{D}(cell, types, subg, opts)], length(pvmaps), vmap)) end end - return groups + @ifwarn if numdim0 > 0 + _s, _it = numdim0 > 1 ? ("s", "They") : ("", "It") + @warn lazy"Detected $numdim0 structure$_s of dimension 0 in input graph, possibly complex solvent residue$_s. $_it will be ignored for topology computation." + end + groups end UnderlyingNets(g::AbstractString, opts::Options) = UnderlyingNets(PeriodicGraph(g), opts) UnderlyingNets(g::Union{SmallPseudoGraph,AbstractString}; kwargs...) = UnderlyingNets(g, Options(; kwargs...)) diff --git a/test/cif/MOFs/AFIXEW_ASR.cif b/test/cif/MOFs/AFIXEW_ASR.cif new file mode 100644 index 0000000..01c953e --- /dev/null +++ b/test/cif/MOFs/AFIXEW_ASR.cif @@ -0,0 +1,188 @@ +# generated by PACMAN-DDEC6 charge (https://github.com/sxm13/PACMAN/) +data_structure +_chemical_formula_sum "Cd6 H36 C72 N8 O40" +_cell_length_a 13.5253 +_cell_length_b 13.5253 +_cell_length_c 13.6853 +_cell_angle_alpha 78.1045 +_cell_angle_beta 101.895 +_cell_angle_gamma 104.655 + +_symmetry_space_group_name_H-M "P 1" +_symmetry_Int_Tables_number 1 + +loop_ + _symmetry_equiv_pos_as_xyz + 'x, y, z' + +loop_ + _atom_site_type_symbol + _atom_site_label + _atom_site_symmetry_multiplicity + _atom_site_fract_x + _atom_site_fract_y + _atom_site_fract_z + _atom_site_occupancy + _atom_site_charge +Cd Cd1 1.0 0.31633 0.31633 0.25000 1.0000 0.9986996085 +Cd Cd2 1.0 0.68367 0.68367 0.75000 1.0000 0.9986996085 +Cd Cd3 1.0 0.85874 0.94504 0.47086 1.0000 1.0295740396 +Cd Cd4 1.0 0.94504 0.85874 0.02914 1.0000 1.0295740396 +Cd Cd5 1.0 0.14126 0.05496 0.52914 1.0000 1.0295740396 +Cd Cd6 1.0 0.05496 0.14126 0.97086 1.0000 1.0295740396 +H H1 1.0 0.58340 0.25628 0.33333 1.0000 0.359567757 +H H2 1.0 0.25628 0.58340 0.16667 1.0000 0.359567757 +H H3 1.0 0.41660 0.74372 0.66667 1.0000 0.359567757 +H H4 1.0 0.74372 0.41660 0.83333 1.0000 0.359567757 +H H5 1.0 0.31763 0.69225 0.39788 1.0000 0.2836961032 +H H6 1.0 0.69225 0.31763 0.10212 1.0000 0.2836961032 +H H7 1.0 0.68237 0.30775 0.60212 1.0000 0.2836961032 +H H8 1.0 0.30775 0.68237 0.89788 1.0000 0.2836961032 +H H9 1.0 0.00811 0.62385 0.34660 1.0000 0.2963476808 +H H10 1.0 0.62385 0.00811 0.15340 1.0000 0.2963476808 +H H11 1.0 0.99189 0.37615 0.65340 1.0000 0.2963476808 +H H12 1.0 0.37615 0.99189 0.84660 1.0000 0.2963476808 +H H13 1.0 0.56000 0.08650 0.36960 1.0000 0.1265742065 +H H14 1.0 0.08650 0.56000 0.13040 1.0000 0.1265742065 +H H15 1.0 0.44000 0.91350 0.63040 1.0000 0.1265742065 +H H16 1.0 0.91350 0.44000 0.86960 1.0000 0.1265742065 +H H17 1.0 0.48499 0.77663 0.42594 1.0000 0.1465075643 +H H18 1.0 0.77663 0.48499 0.07406 1.0000 0.1465075643 +H H19 1.0 0.51501 0.22337 0.57406 1.0000 0.1465075643 +H H20 1.0 0.22337 0.51501 0.92594 1.0000 0.1465075643 +H H21 1.0 0.26096 0.93634 0.32737 1.0000 0.1402274231 +H H22 1.0 0.93634 0.26096 0.17263 1.0000 0.1402274231 +H H23 1.0 0.73904 0.06366 0.67263 1.0000 0.1402274231 +H H24 1.0 0.06366 0.73904 0.82737 1.0000 0.1465075643 +H H25 1.0 0.09603 0.39519 0.43148 1.0000 0.1465075643 +H H26 1.0 0.39519 0.09603 0.06852 1.0000 0.1465075643 +H H27 1.0 0.90397 0.60481 0.56852 1.0000 0.1465075643 +H H28 1.0 0.60481 0.90397 0.93148 1.0000 0.1465075643 +H H29 1.0 0.81233 0.20775 0.40861 1.0000 0.1402274231 +H H30 1.0 0.20775 0.81233 0.09139 1.0000 0.1402274231 +H H31 1.0 0.18767 0.79225 0.59139 1.0000 0.1402274231 +H H32 1.0 0.79225 0.18767 0.90861 1.0000 0.1402274231 +H H33 1.0 0.84591 0.51655 0.33106 1.0000 0.1465075643 +H H34 1.0 0.51655 0.84591 0.16894 1.0000 0.1465075643 +H H35 1.0 0.15409 0.48345 0.66894 1.0000 0.1465075643 +H H36 1.0 0.48345 0.15409 0.83106 1.0000 0.1465075643 +C C1 1.0 0.40640 0.02820 0.34220 1.0000 -0.0236986137 +C C2 1.0 0.02820 0.40640 0.15780 1.0000 -0.0236986137 +C C3 1.0 0.59360 0.97180 0.65780 1.0000 -0.0236986137 +C C4 1.0 0.97180 0.59360 0.84220 1.0000 -0.0236986137 +C C5 1.0 0.51000 0.02500 0.37100 1.0000 -0.1222977906 +C C6 1.0 0.02500 0.51000 0.12900 1.0000 -0.1222977906 +C C7 1.0 0.49000 0.97500 0.62900 1.0000 -0.1222977906 +C C8 1.0 0.97500 0.49000 0.87100 1.0000 -0.1222977906 +C C9 1.0 0.54020 0.93120 0.40190 1.0000 -0.0129196248 +C C10 1.0 0.93120 0.54020 0.09810 1.0000 -0.0129196248 +C C11 1.0 0.45980 0.06880 0.59810 1.0000 -0.0129196248 +C C12 1.0 0.06880 0.45980 0.90190 1.0000 -0.0129196248 +C C13 1.0 0.46530 0.83970 0.40500 1.0000 -0.1871379732 +C C14 1.0 0.83970 0.46530 0.09500 1.0000 -0.1871379732 +C C15 1.0 0.53470 0.16030 0.59500 1.0000 -0.1871379732 +C C16 1.0 0.16030 0.53470 0.90500 1.0000 -0.1871379732 +C C17 1.0 0.36120 0.84180 0.37720 1.0000 0.2092736785 +C C18 1.0 0.84180 0.36120 0.12280 1.0000 0.2092736785 +C C19 1.0 0.63880 0.15820 0.62280 1.0000 0.2092736785 +C C20 1.0 0.15820 0.63880 0.87720 1.0000 0.2092736785 +C C21 1.0 0.33080 0.93520 0.34590 1.0000 -0.1580736383 +C C22 1.0 0.93520 0.33080 0.15410 1.0000 -0.1580736383 +C C23 1.0 0.66920 0.06480 0.65410 1.0000 -0.1580736383 +C C24 1.0 0.06480 0.66920 0.84590 1.0000 -0.1580736383 +C C25 1.0 0.37490 0.12910 0.30990 1.0000 0.5546942086 +C C26 1.0 0.12910 0.37490 0.19010 1.0000 0.5546942086 +C C27 1.0 0.62510 0.87090 0.69010 1.0000 0.5546942086 +C C28 1.0 0.87090 0.62510 0.80990 1.0000 0.5546942086 +C C29 1.0 0.65200 0.93060 0.42770 1.0000 0.5289289386 +C C30 1.0 0.93060 0.65200 0.07230 1.0000 0.5289289386 +C C31 1.0 0.34800 0.06940 0.57230 1.0000 0.5289289386 +C C32 1.0 0.06940 0.34800 0.92770 1.0000 0.5289289386 +C C33 1.0 0.18780 0.72140 0.35860 1.0000 0.3697927327 +C C34 1.0 0.72140 0.18780 0.14140 1.0000 0.3697927327 +C C35 1.0 0.81220 0.27860 0.64140 1.0000 0.3697927327 +C C36 1.0 0.27860 0.81220 0.85860 1.0000 0.3697927327 +C C37 1.0 0.14520 0.60360 0.37700 1.0000 0.3697927327 +C C38 1.0 0.60360 0.14520 0.12300 1.0000 0.3697927327 +C C39 1.0 0.85480 0.39640 0.62300 1.0000 0.3697927327 +C C40 1.0 0.39640 0.85480 0.87700 1.0000 0.3697927327 +C C41 1.0 0.98090 0.47270 0.37880 1.0000 0.2092736785 +C C42 1.0 0.47270 0.98090 0.12120 1.0000 0.2092736785 +C C43 1.0 0.01910 0.52730 0.62120 1.0000 0.2092736785 +C C44 1.0 0.52730 0.01910 0.87880 1.0000 0.2092736785 +C C45 1.0 0.02450 0.38650 0.41490 1.0000 -0.1759867973 +C C46 1.0 0.38650 0.02450 0.08510 1.0000 -0.1759867973 +C C47 1.0 0.97550 0.61350 0.58510 1.0000 -0.1759867973 +C C48 1.0 0.61350 0.97550 0.91490 1.0000 -0.1759867973 +C C49 1.0 0.96140 0.28740 0.42630 1.0000 -0.0129196248 +C C50 1.0 0.28740 0.96140 0.07370 1.0000 -0.0129196248 +C C51 1.0 0.03860 0.71260 0.57370 1.0000 -0.0129196248 +C C52 1.0 0.71260 0.03860 0.92630 1.0000 -0.0129196248 +C C53 1.0 0.85440 0.27400 0.40170 1.0000 -0.1222977906 +C C54 1.0 0.27400 0.85440 0.09830 1.0000 -0.1222977906 +C C55 1.0 0.14560 0.72600 0.59830 1.0000 -0.1222977906 +C C56 1.0 0.72600 0.14560 0.90170 1.0000 -0.1222977906 +C C57 1.0 0.81070 0.35990 0.36670 1.0000 -0.0408068716 +C C58 1.0 0.35990 0.81070 0.13330 1.0000 -0.0408068716 +C C59 1.0 0.18930 0.64010 0.63330 1.0000 -0.0408068716 +C C60 1.0 0.64010 0.18930 0.86670 1.0000 -0.0408068716 +C C61 1.0 0.87510 0.45910 0.35510 1.0000 -0.2064164772 +C C62 1.0 0.45910 0.87510 0.14490 1.0000 -0.2064164772 +C C63 1.0 0.12490 0.54090 0.64490 1.0000 -0.2064164772 +C C64 1.0 0.54090 0.12490 0.85510 1.0000 -0.2064164772 +C C65 1.0 0.01220 0.19780 0.46370 1.0000 0.5865726799 +C C66 1.0 0.19780 0.01220 0.03630 1.0000 0.5865726799 +C C67 1.0 0.98780 0.80220 0.53630 1.0000 0.5865726799 +C C68 1.0 0.80220 0.98780 0.96370 1.0000 0.5865726799 +C C69 1.0 0.69740 0.35040 0.34000 1.0000 0.5289289386 +C C70 1.0 0.35040 0.69740 0.16000 1.0000 0.5289289386 +C C71 1.0 0.30260 0.64960 0.66000 1.0000 0.5289289386 +C C72 1.0 0.64960 0.30260 0.84000 1.0000 0.5289289386 +N N1 1.0 0.28960 0.74500 0.37950 1.0000 -0.3149622052 +N N2 1.0 0.74500 0.28960 0.12050 1.0000 -0.3149622052 +N N3 1.0 0.71040 0.25500 0.62050 1.0000 -0.3174641936 +N N4 1.0 0.25500 0.71040 0.87950 1.0000 -0.3149622052 +N N5 1.0 0.04134 0.57486 0.36480 1.0000 -0.3174641936 +N N6 1.0 0.57486 0.04134 0.13520 1.0000 -0.3174641936 +N N7 1.0 0.95866 0.42514 0.63520 1.0000 -0.3174641936 +N N8 1.0 0.42514 0.95866 0.86480 1.0000 -0.3174641936 +O O1 1.0 0.28131 0.13189 0.27840 1.0000 -0.5084544985 +O O2 1.0 0.13189 0.28131 0.22160 1.0000 -0.5084544985 +O O3 1.0 0.71869 0.86811 0.72160 1.0000 -0.5084544985 +O O4 1.0 0.86811 0.71869 0.77840 1.0000 -0.5084544985 +O O5 1.0 0.44266 0.21374 0.31320 1.0000 -0.5697554171 +O O6 1.0 0.21374 0.44266 0.18680 1.0000 -0.5697554171 +O O7 1.0 0.55734 0.78626 0.68680 1.0000 -0.5697554171 +O O8 1.0 0.78626 0.55734 0.81320 1.0000 -0.5697554171 +O O9 1.0 0.71625 0.01455 0.42640 1.0000 -0.5084544985 +O O10 1.0 0.01455 0.71625 0.07360 1.0000 -0.517514941 +O O11 1.0 0.28375 0.98545 0.57360 1.0000 -0.517514941 +O O12 1.0 0.98545 0.28375 0.92640 1.0000 -0.517514941 +O O13 1.0 0.68044 0.84576 0.45260 1.0000 -0.5327892869 +O O14 1.0 0.84576 0.68044 0.04740 1.0000 -0.5327892869 +O O15 1.0 0.31956 0.15424 0.54740 1.0000 -0.5327892869 +O O16 1.0 0.15424 0.31956 0.95260 1.0000 -0.5327892869 +O O17 1.0 0.10609 0.21451 0.50090 1.0000 -0.517514941 +O O18 1.0 0.21451 0.10609 0.99910 1.0000 -0.517514941 +O O19 1.0 0.89391 0.78549 0.49910 1.0000 -0.517514941 +O O20 1.0 0.78549 0.89391 0.00090 1.0000 -0.517514941 +O O21 1.0 0.96107 0.10833 0.45630 1.0000 -0.5811833262 +O O22 1.0 0.10833 0.96107 0.04370 1.0000 -0.5811833262 +O O23 1.0 0.03893 0.89167 0.54370 1.0000 -0.5811833262 +O O24 1.0 0.89167 0.03893 0.95630 1.0000 -0.5811833262 +O O25 1.0 0.65750 0.42230 0.30090 1.0000 -0.4711563184 +O O26 1.0 0.42230 0.65750 0.19910 1.0000 -0.4711563184 +O O27 1.0 0.34250 0.57770 0.69910 1.0000 -0.4711563184 +O O28 1.0 0.57770 0.34250 0.80090 1.0000 -0.4711563184 +O O29 1.0 0.64457 0.25763 0.35660 1.0000 -0.4416064142 +O O30 1.0 0.25763 0.64457 0.14340 1.0000 -0.4416064142 +O O31 1.0 0.35543 0.74237 0.64340 1.0000 -0.4416064142 +O O32 1.0 0.74237 0.35543 0.85660 1.0000 -0.4416064142 +O O33 1.0 0.13093 0.78227 0.33060 1.0000 -0.4202988117 +O O34 1.0 0.78227 0.13093 0.16940 1.0000 -0.4202988117 +O O35 1.0 0.86907 0.21773 0.66940 1.0000 -0.4202988117 +O O36 1.0 0.21773 0.86907 0.83060 1.0000 -0.4202988117 +O O37 1.0 0.20446 0.54534 0.40060 1.0000 -0.4202988117 +O O38 1.0 0.54534 0.20446 0.09940 1.0000 -0.4202988117 +O O39 1.0 0.79554 0.45466 0.59940 1.0000 -0.4202988117 +O O40 1.0 0.45466 0.79554 0.90060 1.0000 -0.4202988117 diff --git a/test/runtests.jl b/test/runtests.jl index 6d11ce3..bc63e72 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -48,7 +48,11 @@ import CrystalNets.Clustering: SingleNodes, AllNodes, Standard, PE, PEM mofdataset = determine_topology_dataset(joinpath(cifs, "MOFs"), save=false, showprogress=false; kwargs...) @testset "Dataset analysis" begin - @test length(mofdataset) == 15 + @test length(mofdataset) == 16 + + afixew, afixew_nfold = only(mofdataset["AFIXEW_ASR.cif"]) + @test afixew_nfold == 4 + @test afixew[AllNodes] == afixew[SingleNodes] == parse(TopologicalGenome, "bex") hkust1 = extract1(mofdataset["HKUST-1.cif"]) @test hkust1[SingleNodes] == hkust1[AllNodes] == hkust1[Standard] @@ -398,7 +402,7 @@ end @testset "Unstable nets" begin minimize_to_unstable = PeriodicGraph("2 1 1 0 1 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 2 2 0 1 2 3 1 0 2 4 1 0 2 5 0 0 2 6 0 0") net_minimize_to_unstable = topological_genome(CrystalNet(minimize_to_unstable)) - @test string(net_minimize_to_unstable) == "unstable 2" + @test startswith(string(net_minimize_to_unstable), "unstable 2") mini2 = PeriodicGraph("2 1 4 0 0 1 2 0 0 1 3 0 0 2 3 0 1 4 5 0 0 4 6 0 0 5 6 1 0")