Repository navigation
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 49 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Infer atomic numbers and a covalent-radius distance matrix when optional CALYPSO fields are omitted. Closes deepmodeling#357 Coding-Agent: Codex Codex-Version: codex-cli 0.149.1 Model: gpt-5.6-sol Reasoning-Effort: xhigh
262334f to
3a037c0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #383 +/- ##
==========================================
+ Coverage 85.98% 86.01% +0.02%
==========================================
Files 105 105
Lines 6930 6942 +12
==========================================
+ Hits 5959 5971 +12
Misses 971 971 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Retracted. This review was produced without running the mandated /code-review fan-out (the loop skill's section 2); the substitute process used instead has since been shown to miss findings and, in one case, to state a verified-sounding falsehood. Re-reviewing properly.
wanghan-iapcm
left a comment
There was a problem hiding this comment.
The fix is right: with the pre-PR source, a flat name_of_atoms that omits either field crashes in make_calypso_input (TypeError: object of type 'NoneType' has no len()), and this closes that. Blocking only on the test, which cannot detect a wrong default.
The test does not pin the distance values
The substance of this change is choosing numeric defaults, but the only assertions on the matrix are shape == (2, 2) and > 0. I mutated the PR's own lines and re-ran the module each time:
* 0.7 -> * 7.0 (10x wrong minimum distance) Ran 5 tests ... OK
radius index + 1 (every element reads its neighbour's radius) OK
if isinstance(distance_of_ions, dict) -> if False (dict override loop dropped) OK
self.distance_of_ions = temp_distance_mtx * 0 + 0.01 (constant matrix) OK
All four pass. Only a mutant on the atomic-number inference (+1 on line 148) is caught, so the atomic_number == [3, 57] assertion is doing its job; the distance half is not.
For the Li/La config already in the test, the exact matrix through your code path is
np.testing.assert_allclose(
task_group.distance_of_ions, [[1.79, 2.34], [2.34, 2.90]]
)which kills the first, second and fourth mutants. The third (the dict-override loop being dropped) needs one more case: nothing anywhere in tests/ pins a computed value for a distance_of_ions dict, and this PR restructures that loop while the description says it preserves per-element overrides. {"Li": 2.0} on the same config gives [[2.8, 2.85], [2.85, 2.9]]; asserting that pins the override path too.
Not blocking
- A mismatched
numb_of_species(e.g. 3 with two names) now raises a bareIndexErrorfrom the generation loop, where before it reached the assert incaly_input.pythat prints the offending values. Such a config was always fatal, so this is message quality only; anumb_of_species != len(self.name_of_atoms)check above the loop would restore it. - On merge order: this conflicts with #382 only in the test file (both append at the end); the source hunks merge cleanly. #405 merges cleanly with this PR.
| task_group = make_calypso_task_group_from_config(config) | ||
|
|
||
| self.assertEqual(task_group.atomic_number, [3, 57]) | ||
| self.assertEqual(task_group.distance_of_ions.shape, (2, 2)) |
There was a problem hiding this comment.
These two assertions only establish that a square, positive matrix was produced. I mutated the source four ways (0.7 -> 7.0; radius index +1; dict-override loop replaced by if False; matrix replaced by a constant 0.01) and all five tests stayed green each time.
Please pin the values instead. For this Li/La config:
np.testing.assert_allclose(
task_group.distance_of_ions, [[1.79, 2.34], [2.34, 2.90]]
)and one dict case, since no test in the repo pins an override value and this PR restructures that loop: distance_of_ions={"Li": 2.0} on the same config gives [[2.8, 2.85], [2.85, 2.9]].
The atomic_number == [3, 57] line above is fine; it does catch an off-by-one in the symbol table.
There was a problem hiding this comment.
Pinned both exact matrices in 82cd2ab: Li/La defaults [[1.79, 2.34], [2.34, 2.90]] and Li=2.0 override [[2.8, 2.85], [2.85, 2.9]]. Tests also check serialized input, independently omitted fields, explicit lists and that overrides leave the shared defaults intact. All four listed mutants now fail. Added the requested diagnostics/docs, including rejection of placeholder default radii unless explicitly supplied. CPU exploration suite: 69 tests + 7 subtests passed.
Agent: dot
Address wanghan-iapcm's review with regression and mutation-tested coverage. Agent: dot
Summary
{"Li": 2.0}radius-override matrix, including serialized CALYPSO inputVerification
git diff --checkpassedTests are in a dedicated module to avoid the shared insertion-point conflict with #382.
Closes #357
Agent: dot