Closed kenko911 closed 2 weeks ago
The main change in the ase.py
file within src/matgl/ext
includes introducing a new FrechetCellFilter
import from ase.filters
and updating the relax
function to support a new ase_cellfilter
parameter. This parameter determines whether to use a FrechetCellFilter
or an ExpCellFilter
, enabling more flexible filtering options.
Files | Change Summary |
---|---|
src/matgl/ext/ase.py |
Added from ase.filters import FrechetCellFilter ; updated relax function parameters and logic to select between FrechetCellFilter and ExpCellFilter based on ase_cellfilter value. |
sequenceDiagram
participant User
participant relax Function
participant FrechetCellFilter
participant ExpCellFilter
User->>relax Function: Call relax with ase_cellfilter="Frechet"
alt ase_cellfilter=="Frechet"
relax Function->>FrechetCellFilter: Instantiate FrechetCellFilter
else ase_cellfilter=="Exp"
relax Function->>ExpCellFilter: Instantiate ExpCellFilter
end
relax Function-->>User: Return filtered result
src/matgl/ext/ase.py (5)
`20-20`: **Import of FrechetCellFilter added.** The addition of `FrechetCellFilter` from `ase.filters` is consistent with the PR's objective to enable variable cell relaxation using this filter. Ensure that all dependencies and usage contexts within the project also reflect this change, if necessary. --- `257-258`: **Updated method signature in `Relaxer.relax`.** The method signature now includes `ase_cellfilter` and `params_asecellfilter`, which allows for dynamic selection between `FrechetCellFilter` and `ExpCellFilter`. This is a significant enhancement aligning with the PR's objectives to enable more flexible cell relaxation options. --- `272-273`: **Documentation update for new parameters.** The documentation clearly explains the purpose of `ase_cellfilter` and `params_asecellfilter`, providing references and examples. This is helpful for users and maintains good documentation practices. Also applies to: 275-275 --- `286-290`: **Conditional creation of cell filters.** The implementation correctly creates either a `FrechetCellFilter` or an `ExpCellFilter` based on the `ase_cellfilter` parameter. This dynamic approach enhances flexibility in the relaxation process. --- `299-299`: **Proper handling of `atoms` object after relaxation.** The method correctly checks if the `atoms` object is wrapped by a cell filter and extracts the underlying `Atoms` object if necessary. This ensures that the return structure is always of the expected type.
Summary
The FrechetCellFilter class is added for variable cell relaxation in Relaxer. It achieves better convergence with respect to cell variables.
Checklist
ruff
.mypy
.duecredit
@due.dcite
decorators to reference relevant papers by DOI (example)Tip: Install
pre-commit
hooks to auto-check types and linting before every commit: