Skip to content

Pickle rebased - #9

Merged
pmrv merged 3 commits into
masterfrom
pickle-rebased
Aug 9, 2026
Merged

Pickle rebased#9
pmrv merged 3 commits into
masterfrom
pickle-rebased

Conversation

@pmrv

@pmrv pmrv commented Aug 8, 2026

Copy link
Copy Markdown
Owner

enable pickling of both b and c tilde based aces.

pmrv and others added 3 commits August 8, 2026 11:19
The default reducer puts out the evaluator and a bunch of
other C++ extension types that pickle then chokes on.
Side step the problem here by providing a reducer that just
makes unpickling equivalent to a new instantiation.
The only difficulty here is that basis_set stays a file name
if initialized like that and that PyACECalculator.__init__
expects it as a positional argument.
Avoid the filename by dumping the whole bbasis config, so that
unpickling can happen on other machines or in different locations.
ACECTildeBasisSet cannot be converted back to a BBasisConfiguration,
so the previous reducer failed for calculators loaded from .ace/.yace
potentials. Pass the Ctilde basis set through as is instead; its
pybind11 binding already provides native pickle support.

While at it, preserve the constructor kwargs (recursive_evaluator,
gamma bounds, etc.) across the pickle round trip via a module-level
helper, and drop the stale todict() state that previously leaked the
original basis_set parameter (e.g. a file name) into the unpickled
instance.

Add round-trip tests for B-basis, Ctilde and recursive Ctilde
calculators.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHj67uGNHN5bMH7LPoCR1J
Address review: cover the Al-Ni .yace test potential and compare
energies/forces along a whole BFGS dimer minimization trajectory
between the original and the unpickled calculator.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BHj67uGNHN5bMH7LPoCR1J
@pmrv
pmrv merged commit f205e26 into master Aug 9, 2026
2 of 3 checks passed
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.

2 participants