-
Notifications
You must be signed in to change notification settings - Fork 14
Towards graph AD for Forces #111
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
Closed
Closed
Changes from 16 commits
Commits
Show all changes
101 commits
Select commit
Hold shift + click to select a range
f70b1b7
features: rename `OrbitalFieldMatrix` to `OrbitalFeatureDescriptor`
thazhemadam 3163da9
codec: rename OneHotOneCold.jl to onehotonecold.jl
thazhemadam 69bd611
codec: create a simple codec - `SimpleCodec`
thazhemadam f6737fb
elementfeature: add constructor for building `ElementFD` from name,codec
thazhemadam 2378190
features: simplify encoding-decoding logic, and minimize repetitive code
thazhemadam 9161923
Merge branch 'move_bov' of github.com:Chemellia/ChemistryFeaturizatio…
thazhemadam f1b4588
data:tabulate_pmg_data.py: update script to include Electronic Structure
thazhemadam a2f34b5
data: pymatgen_atom_data.csv: update to include Electronic Structure
thazhemadam 21f2d11
test: ElementFeature_tests: reorganize tests into testsets
thazhemadam 23393a2
Merge branch 'main' of github.com:Chemellia/ChemistryFeaturization.jl…
thazhemadam 7e6ad96
atoms: add new generic `elements()` function
thazhemadam b03a159
test: add tests and improve coverage
thazhemadam 23b1ecf
features: make `output_shape` generic
thazhemadam 0004aed
orbitalfeaturedescriptor: basic sketch
thazhemadam fd42c7e
orbitalfeature: annotate, fix order of shells in lookup in defaultdecode
thazhemadam 120c4c1
orbitalfeature: trim down `lookup_table`
thazhemadam d21c568
data: pymatgen_atom_data: standardize `Lawrencium`'s configuration value
thazhemadam d799766
atoms: export `elements` at the main module level
thazhemadam a32599d
data.jl: create new module - `Data`
thazhemadam 374904b
data.jl: remove const-ness for `atom_data_df` and `feature_info`
thazhemadam 5a732f8
orbitalfeature: remove `lookup_table` field
thazhemadam f02bb76
orbitalfeature: add custom `Base.show` methods
thazhemadam ccb8ba1
add Zygote to deps
DhairyaLGandhi 678e1de
refactor weight_cutoff
DhairyaLGandhi 17d93f0
basic adjoints - TODO - move them to Zygote
DhairyaLGandhi 1c551e9
fixes to cutoff adjoint
DhairyaLGandhi bd6fe29
add backwards lengths in adjoint
DhairyaLGandhi cbb55ea
make fn amenable to FiniteDifferences
DhairyaLGandhi 65d9bc0
add tests for AD
DhairyaLGandhi faa6648
add FiniteDiff to test deps
DhairyaLGandhi 68b90fb
fix tests
DhairyaLGandhi d2ff77c
fix equality
DhairyaLGandhi 0ac1c19
Add Xtals dep, sketch out neighbor list function
rkurchin e011a6b
update sketch to use NearestNeighbors.jl
rkurchin eb806cb
simplify cutoff adjoint
DhairyaLGandhi f262cf1
finitedifferences fix
DhairyaLGandhi 46cadf8
better tests
DhairyaLGandhi bb12d1c
fixes
DhairyaLGandhi 85d898f
fix typo
DhairyaLGandhi 872e5fc
another typo
DhairyaLGandhi 73268d9
refactor tests
DhairyaLGandhi 46498dd
cleanup
DhairyaLGandhi 53b4e85
give it another shot
DhairyaLGandhi 01d5c33
Update README.md
ViralBShah 7b14382
Update README.md
ViralBShah 81c61ef
basic neighbor list implementtion is there
rkurchin b0d6b1a
formatting
rkurchin f5dc410
Should be ready to test autodiff on this!
rkurchin 909a41c
formatting
rkurchin 4f42fe0
compat and docs build to julia 1.6 to match Xtals
rkurchin 74375f4
add spaces between badges
DhairyaLGandhi 3b5f92a
Update src/utils/graph_building.jl
rkurchin 6e45306
don't change rc (this means we need absolute paths to cifs), add chec…
rkurchin c66ee74
Merge branch 'graph_ad' of https://github.com/Chemellia/ChemistryFeat…
rkurchin 64edcd4
formatting
rkurchin 1b8cb56
minor version bump
rkurchin 324b828
update changelog
rkurchin b548f60
construct AtomGraph from Crystal
rkurchin 79c6287
docs: remove explicit `versions` so it can possibly publish `dev` too?
thazhemadam 94fbbd0
Merge pull request #115 from Chemellia/at/doc-dev-publish
thazhemadam 9887a06
docs: add overview section for types, tweak `terminology and philosophy`
thazhemadam 8e55598
docs: add more info into docs for types, minor restructuring and links
thazhemadam 02a9b4f
docs: add examples for what a feature could be
thazhemadam f6f5ab5
orbitalfeature:clean up default_ofd_decode & rename valence_shell_config
thazhemadam fb2c4ff
orbitalfeaturedescriptor: add docstrings
thazhemadam 7d155a9
tests: add `OrbitalFeatureUtils` tests
thazhemadam 3f5dc40
orbitalfeatureutils: make `df::DataFrame` an optional argument
thazhemadam 9c581c1
features: fix bug in `output_shape` by renaming `fd` to `efd`
thazhemadam ba4f8c4
Merge pull request #116 from Chemellia/at/docs
thazhemadam 4565893
Merge pull request #100 from Chemellia/at/orbital-fd
thazhemadam 82b04a9
changelog: include changes made in #100
thazhemadam 68fdf54
Merge branch 'main' into graph_ad
rkurchin 03d96d2
fix Atoms namespace conflict in AtomGraph tests...this probably needs…
rkurchin 35a4c13
formatting
rkurchin 8b6d05e
add other AtomGraph constructor to docs
rkurchin d04e46c
Merge pull request #112 from Chemellia/graph_ad
rkurchin aa7d310
update compats and changelog
rkurchin 991f878
add Zygote to deps
DhairyaLGandhi 84b1834
refactor weight_cutoff
DhairyaLGandhi c683a55
basic adjoints - TODO - move them to Zygote
DhairyaLGandhi ec29db1
fixes to cutoff adjoint
DhairyaLGandhi bb0e2c6
add backwards lengths in adjoint
DhairyaLGandhi 7b17f24
make fn amenable to FiniteDifferences
DhairyaLGandhi 4261c2d
add tests for AD
DhairyaLGandhi 504dd2f
add FiniteDiff to test deps
DhairyaLGandhi b65b853
fix tests
DhairyaLGandhi d53f9af
fix equality
DhairyaLGandhi 8011d10
simplify cutoff adjoint
DhairyaLGandhi e97a375
finitedifferences fix
DhairyaLGandhi 3bd7996
better tests
DhairyaLGandhi 77db19a
fixes
DhairyaLGandhi 1662228
fix typo
DhairyaLGandhi 6e78367
another typo
DhairyaLGandhi c17ce49
refactor tests
DhairyaLGandhi 496475f
cleanup
DhairyaLGandhi 2f5ab3d
give it another shot
DhairyaLGandhi b1194d2
rebase
DhairyaLGandhi 8f5606f
add code but dont include
DhairyaLGandhi 239a2b6
cleanups for unneeded adjoints
DhairyaLGandhi 1f9529f
fixes
DhairyaLGandhi 72b4542
refactor + array distance
DhairyaLGandhi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| using Zygote # , ChainRulesCore | ||
| using Zygote: @adjoint | ||
| using LinearAlgebra | ||
|
|
||
| @adjoint function Base.Generator(f, iter) | ||
| ys, backs = Zygote.unzip([Zygote.pullback(f, x) for x in iter]) | ||
| Base.Generator(f, iter), Δ -> begin | ||
| b(d::Dict) = [back(v)[1] for (back,v) in zip(backs,values(d))] | ||
| b(nt::NamedTuple{(:f, :iter)}) = [back(i)[1] for (back,i) in zip(backs,nt.iter)] | ||
| (nothing, b(Δ)) | ||
| end | ||
| end | ||
|
|
||
| @adjoint function Base.Iterators.Zip(is) | ||
| Zip_pullback(Δ) = (Zygote.unzip(Δ),) | ||
| return Base.Iterators.Zip(is), Zip_pullback | ||
thazhemadam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
|
|
||
| @adjoint function Pair(a, b) | ||
| Pair(a, b), Δ -> (Δ, nothing) | ||
thazhemadam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
|
|
||
| @adjoint function Dict(g::Base.Generator) | ||
| ys, backs = Zygote.unzip([Zygote.pullback(g.f, args) for args in g.iter]) | ||
| Dict(ys...), Δ -> begin | ||
| ∂d = first(backs)(Δ)[1] | ||
| d = Dict(ys...) | ||
| for (k,v) in pairs(d) | ||
| d[k] = _zero(v) | ||
thazhemadam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
| (merge(d, ∂d), ) | ||
| end | ||
thazhemadam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
|
|
||
| _zero(x) = zero(x) | ||
| _zero(::Nothing) = nothing | ||
|
|
||
| @adjoint function _cutoff!(weight_mat, f, ijd, | ||
| nb_counts, longest_dists; | ||
| max_num_nbr = 12) | ||
| y, ld = _cutoff!(weight_mat, f, ijd, | ||
| nb_counts, longest_dists; | ||
| max_num_nbr = max_num_nbr) | ||
| function cutoff_pb((Δ,nt)) | ||
| s = size(Δ) | ||
| Δ = vec(collect(Δ)) | ||
| for (ix,(_,_,d)) in zip(eachindex(Δ), ijd) | ||
| y_, back_ = Zygote.pullback(f, d) | ||
| Δ[ix] *= back_(Δ[ix])[1] | ||
| end | ||
| (reshape(Δ, s), nothing, | ||
| collect(zip(fill(nothing, size(Δ,1)), | ||
| fill(nothing, size(Δ,1)), | ||
| Δ)), | ||
| nothing, | ||
| nothing) | ||
| end | ||
|
|
||
| (y,ld), cutoff_pb | ||
thazhemadam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.