Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph building and file I/O with Xtals.jl #112

Merged
merged 19 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
SimpleWeightedGraphs = "47aef6b3-ad0c-573a-a1e2-d07658019622"
Xtals = "ede5f01d-793e-4c47-9885-c447d1f18d6d"
thazhemadam marked this conversation as resolved.
Show resolved Hide resolved

thazhemadam marked this conversation as resolved.
Show resolved Hide resolved
[compat]
CSV = "0.7, 0.8"
Expand Down
36 changes: 36 additions & 0 deletions src/utils/graph_building.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,42 @@ function weights_voronoi(struc)
weight_mat = 0.5 .* (weight_mat .+ weight_mat')
end

using Xtals
rc[:paths][:crystals] = @__DIR__
function dists_xtals(fpath::String)
c = Crystal(fpath)
# ...
end

"""
Find all lists of pairs of atoms in `crys` that are within a distance of `cutoff_radius` of each other, respecting periodic boundary conditions.

Returns as is, js, dists to be compatible with ASE's output format for the analogous function.
"""
function neighbor_list(crys::Crystal,
cutoff_radius::Real = 8.0,
max_num_nbr::Int = 12,
)
thazhemadam marked this conversation as resolved.
Show resolved Hide resolved
n_atoms = c.atoms.n

local is = Int[]
local js = Int[]
local dists = Float64[]

# make 3 x 3 x 3 supercell and figure out index mapping
sc = replicate(c, (3,3,3))
thazhemadam marked this conversation as resolved.
Show resolved Hide resolved
# ...

# iterate over each "center" atom in the supercell and each potential neighbor
for i = 1:sc.atoms.n, j = 1:sc.atoms.n
# compute distance from i to j,
# check for cutoffs,
# map back to primitive cell indices and store
end

return is, js, dists
end

# TODO: graphs from SMILES via OpenSMILES.jl

end