Lattice dynamics workflow using Pheasy#1063
Lattice dynamics workflow using Pheasy#1063hrushikesh-s wants to merge 181 commits intomaterialsproject:mainfrom
Conversation
Modified some parts based on Janine's comments.
…atomate2 into atomate2_jz_pheasy
…group for crystals.
Update pheasy job execution commands to explicitly pass displacement and force matrix files generated by atomate2. Changes: - Pass --disp_matrix_file and --force_matrix_file to pheasy during sensing matrix construction and IFC fitting - Replace implicit file-based displacement/force reconstruction with explicit matrix-based input when available
Update GitHub Actions workflow & pyproject.toml to fix env setup. Changes: - Consolidate micromamba dependency installation into a single command - Add missing core dependencies for alamode (compilers, boost, eigen, cmake, spglib, scipy, h5py) - Remove separate ALA-mode installation step - Include alamode in pip installation dependencies
Remove local definition of PhononBSDOSDoc from phonons.py. This schema is already provided by emmet and imported in the beginning, so maintaining a duplicate definition is unnecessary and can lead to inconsistencies.
…non test Changes: - Added "torchsim" to the supported code list in `get_factor` so that phonon frequency conversion works correctly for TorchSim-based calculations. - Updated `test_phonon_wf_force_field` to use `assert_allclose` with a relaxed tolerance instead of element-wise `pytest.approx`, reducing brittleness due to small numerical differences in thermodynamic quantities. Rationale: - TorchSim behaves similarly to forcefield-based calculators but was not previously recognized in the phonon conversion logic, leading to failures. - The phonon's thermodynamic test was overly sensitive to small numerical variations (eg due to backend changes like CHGNet to matgl transition?), causing unnecessary test failures.
This commit updates the GitHub Actions test workflow to invoke pytest using `python -m pytest` via `micromamba run`, instead of relying on shell activation and the `pytest` executable. Changes: - Replaced `micromamba activate a2` + `pytest ...` with `micromamba run -n a2 python -m pytest ...` across all test steps. Reason: - Fixes CI failures where `pytest` was not found due to PATH issues after environment activation. - Ensures tests are executed within the correct environment regardless of shell behavior.
- Update thermo reference values for matgl-backed phonon workflows - Enable thermal displacement generation in pheasy test (create_thermal_displacements=True) - Relax force_constants type check (tuple --> list | tuple) - Update total_dft_energy expectation (per-atom normalization) - Fix CI dependency stack for torch-limited forcefields
|
Hi @JaGeo, does this look okay? |
|
@hrushikesh-s thanks! I think one point we need to discuss is the deprecation of the phonon related schema. Our codes actually depend on the old schema and i think we should handle this carefully. |
|
Hi @JaGeo , Thanks for bringing this up, that makes a lot of sense. I agree that switching directly to the Emmet models could be disruptive since earlier production codes may still rely on the current atomate2 schema. Would it be reasonable to handle this in a phased way? What I had in mind is:
This way we can move toward the new schema without introducing a breaking change immediately. Does that sound like a reasonable approach to you? If yes, then I can make these edits to the current PR. |
|
I do recall a discussion involving @esoteric-ephemera that we wanted to potentially keep both options. |
This commit restores support for the legacy atomate2 phonon document schemas while introducing optional support for the newer Emmet schemas across phonon-related workflows. Deprecation decision: No deprecation is introduced in this commit Both schemas are supported going forward Deprecation of legacy atomate2 phonon schemas is deferred and will be discussed separately with a proper timeline
…tomate2 data schema
|
I don't remember off hand how much the two schemas differ, can you point me to the fields that are needed in the legacy schema that are missing in the new emmet one @hrushikesh-s? |
|
Hi @esoteric-ephemera , I compared the legacy atomate2 phonon schema against the new emmet one. The main differences are:
Aside -- I tried to restore the legacy phonon schema functionality for the phonon, QHA, and Grüneisen workflows, and have fixed the associated test failures. Can you pls take a look and confirm whether these changes align with the goal of continuing to support the legacy schema for these workflows in the short term, with a plan to migrate to the emmet schema later? |
|
Also, it's worthwhile to mention that the current PR makes use of my fork of Pheasy repo, and the PR is underway on Pheasy to make it compatible with the current atomate2 style reading of .npy files for disp & force matrices |
|
Thanks! From the timeline: i will likely look at it after Easter (next week earliest). I have to grade and prepare my teaching this week. I would also like to test and explore the changes in detail. |
Summary
Include a summary of major changes in bullet points:
Additional dependencies introduced (if any)
Before a pull request can be merged, the following items must be checked:
The easiest way to handle this is to run the following in the correct sequence on
your local machine. Start with running
ruffandruff formaton your new code. This willautomatically reformat your code to PEP8 conventions and fix many linting issues.
Run ruff on your code.
type check your code.