Commit 1f0317e
authored
fix(tf): preserve non-PBC ASE neighbor semantics (#5859)
Closes #5668.
## Summary
- preserve the original cells=None decision separately from the identity
box required by TensorFlow placeholders
- pass a missing cell to ASE for open systems and make both TF1
neighbor-list builders handle that documented input without creating
periodic ghosts
- correct the builders return annotations and document their
open-boundary behavior
- add collected regressions for DeepPotential and for DeepTensor
eval/eval_full
## Why existing tests missed this
- the original external ASE neighbor-list tests were designed around
periodic systems and never exercised cells=None
- the parameterized TestDeepPot symbol is replaced by object, so
TestDeepPotNeighborList did not inherit the base evaluation tests;
collection contained only two locally declared skipped tests
- although the DeepPotential testcase YAML contains a box: null result,
it therefore never ran through the ASE-backed evaluator
- DeepTensor neighbor-list tests inherited PBC fixtures and had no
native-versus-ASE open-boundary comparison
## Validation
- focused DeepPotential no-PBC regression: passed
- focused DeepTensor eval/eval_full no-PBC regression: passed
- full TestDeepDipoleNewPBCNeighborList class: 10 passed, 2 skipped
- TF1 DeepPotential periodic native-versus-ASE parity smoke: passed
- pytest collect-only confirms both new regressions are collected
- ruff format .
- ruff check .
- git diff --check
Coding agent: Codex
Codex version: codex-cli 0.144.4
Model: gpt-5.6-sol
Reasoning effort: xhigh
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Bug Fixes**
- Fixed neighbor-list construction for open-boundary (no PBC) systems to
preserve correct boundary semantics.
- Ensured consistent neighbor-list handling across TensorFlow inference
paths (including energy/tensor and dipole evaluation), so results no
longer depend on placeholder cell inputs.
- **Tests**
- Added new no-PBC neighbor-list verification against reference outputs
(forces, energies, and virials).
- Added dipole coverage confirming neighbor-list-based results match
native neighbor-list behavior, including legacy implementation checks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: njzjz-bot <njzjz.bot@gmail.com>
Co-authored-by: njzjz-bot <njzjz-bot@users.noreply.github.com>1 parent e37cc00 commit 1f0317e
4 files changed
Lines changed: 132 additions & 22 deletions
File tree
- deepmd/tf/infer
- source/tests
- infer
- tf
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
552 | | - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
556 | 563 | | |
557 | 564 | | |
558 | 565 | | |
559 | 566 | | |
560 | | - | |
| 567 | + | |
| 568 | + | |
561 | 569 | | |
562 | 570 | | |
563 | 571 | | |
| |||
587 | 595 | | |
588 | 596 | | |
589 | 597 | | |
590 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
591 | 603 | | |
592 | 604 | | |
593 | 605 | | |
| |||
814 | 826 | | |
815 | 827 | | |
816 | 828 | | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
817 | 832 | | |
818 | 833 | | |
819 | 834 | | |
| |||
884 | 899 | | |
885 | 900 | | |
886 | 901 | | |
887 | | - | |
| 902 | + | |
888 | 903 | | |
889 | 904 | | |
890 | 905 | | |
| |||
1534 | 1549 | | |
1535 | 1550 | | |
1536 | 1551 | | |
1537 | | - | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1538 | 1560 | | |
1539 | 1561 | | |
1540 | 1562 | | |
1541 | 1563 | | |
1542 | 1564 | | |
1543 | 1565 | | |
1544 | 1566 | | |
1545 | | - | |
| 1567 | + | |
| 1568 | + | |
1546 | 1569 | | |
1547 | 1570 | | |
1548 | 1571 | | |
| |||
1572 | 1595 | | |
1573 | 1596 | | |
1574 | 1597 | | |
1575 | | - | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
1576 | 1603 | | |
1577 | 1604 | | |
1578 | 1605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
205 | 208 | | |
206 | 209 | | |
207 | 210 | | |
| |||
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
230 | | - | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
346 | 349 | | |
347 | 350 | | |
348 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
349 | 355 | | |
350 | 356 | | |
351 | 357 | | |
| |||
373 | 379 | | |
374 | 380 | | |
375 | 381 | | |
376 | | - | |
| 382 | + | |
377 | 383 | | |
378 | 384 | | |
379 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
44 | 38 | | |
45 | 39 | | |
46 | 40 | | |
| |||
396 | 390 | | |
397 | 391 | | |
398 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
399 | 405 | | |
400 | 406 | | |
401 | 407 | | |
402 | 408 | | |
403 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
404 | 412 | | |
405 | 413 | | |
406 | 414 | | |
407 | 415 | | |
408 | 416 | | |
409 | | - | |
| 417 | + | |
410 | 418 | | |
411 | | - | |
| 419 | + | |
412 | 420 | | |
413 | 421 | | |
414 | 422 | | |
| |||
421 | 429 | | |
422 | 430 | | |
423 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
1162 | 1165 | | |
1163 | 1166 | | |
1164 | 1167 | | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
0 commit comments