Skip to content

Periodic - #119

Merged
marvinfriede merged 4 commits into
mainfrom
periodic
Oct 4, 2026
Merged

marvinfriede merged 4 commits into
mainfrom
periodic

Conversation

@marvinfriede

Copy link
Copy Markdown
Member

No description provided.

marvinfriede and others added 4 commits October 3, 2026 23:52
`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>
@marvinfriede
marvinfriede merged commit f81c142 into main Oct 4, 2026
29 checks passed
@marvinfriede
marvinfriede deleted the periodic branch October 4, 2026 07:58

This branch was successfully deployed

1 active deployment
codecov — 8a0b2d23 Deployed Oct 4, 2026 by marvinfriede via Upload to Codecov #218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant