Repository navigation
Periodic - #119
Merged
Merged
Periodic#119
Conversation
`dftd3`, `dispersion` and `dispersion2` take a `lattice` (and optionally `periodic` and prebuilt `shifts`). The coordination number and the two-body energy then sum over every periodic image within their cutoff, as in s-dftd3. Atoms are folded into the cell along the periodic axes only, so slabs and chains keep their open axes. The dense three-body term stays molecular and raises for a cell. The image shifts are built eagerly by default. Passing a table built by `tad_mctc.neighbor.images.build_periodic_shifts` keeps the evaluation fixed-shape, so it works under `vmap`, `jacrev`/`jacfwd` with respect to positions and lattice, and `torch.compile(fullgraph=True)`. Tests compare energies, gradients, virials and Hessians against s-dftd3 for X23 molecular crystals, inorganic and synthetic cells, slabs, chains and padded batches, at both default and pinned cutoffs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`dftd3`, `dispersion`, `dispersion2`, `dispersion3` and `damping.dispersion_atm` take a `tad_mctc.Structure` instead of `numbers` and `positions`. A periodic cell is a `Structure` with a `lattice` and `periodic` mask, replacing the separate `lattice` and `periodic` arguments; prebuilt image `shifts` stay a keyword argument. Calls with `numbers` and `positions` raise a `TypeError` pointing at the new call. Under `vmap` over a batched `Structure`, a lattice or mask shared by the batch would be split per system, so it raises and asks for one per system. The three-body functions reject a cell. Tests, examples, docstrings and the README (with a migration note) use the new call. New tests cover `vmap` directly over a `Structure`, derivatives via `Structure.replace` and `torch.compile` with a `Structure` argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.