Skip to content

Commit

Permalink
Remove carbon-metal bonds longer than 2.4 Å
Browse files Browse the repository at this point in the history
  • Loading branch information
Liozou committed May 13, 2024
1 parent 3828c74 commit 125256e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Manifest.toml
.vscode/
.ipynb_checkpoints/
test/RCSRnets-*
*.code-workspace
19 changes: 18 additions & 1 deletion src/input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,26 @@ Check the presence of carbon cycle disorder (multiple cycles superposed).
If present, send a warning and allow the common carbons and the ends of the cycles to have
an additional bond out of the cycle (even if it overcomes the usual bond limits for a
carbon).
Also remove carbon-metal bonds longer than 2.4 Å.
"""
function check_C_disorder!(graph, pos, types, idx, mat)
function check_C_disorder!(graph::PeriodicGraph{N}, pos, types, idx, mat) where {N}
neighs = neighbors(graph, idx)
removeedges = PeriodicVertex{N}[]
for u in neighs
if ismetal[get(atomic_numbers, types[u.v], 1)]
bondlength = Float64(norm(mat * (pos[u.v] .+ u.ofs .- pos[idx])))
if bondlength > 2.4
push!(removeedges, u)
end
end
end
if !isempty(removeedges)
for u in removeedges
rem_edge!(graph, PeriodicEdge(idx, u))
end
neighs = neighbors(graph, idx)
end
length(neighs) 5 || return false
carbons = PeriodicVertex3D[]
for x in neighs
Expand Down

0 comments on commit 125256e

Please sign in to comment.