Skip to content

Add common equation of state (EOS) flow and subflow - #3552

Open
dgaines2 wants to merge 1 commit into
Quantum-Accelerators:mainfrom
dgaines2:add-eos-recipe
Open

dgaines2 wants to merge 1 commit into
Quantum-Accelerators:mainfrom
dgaines2:add-eos-recipe

Conversation

@dgaines2

Copy link
Copy Markdown

Summary of Changes

This adds a calculator-agnostic equation of state workflow in quacc.recipes.common.eos, modeled on atomate2's CommonEosMaker. The structure is volume-strained isotropically, each strained cell gets a fixed-cell relaxation and optionally a static, and the energy-volume data are fit with emmet's EOSDoc. That gives V0, E0, B0 and B1 for the Murnaghan, Birch, Birch-Murnaghan and Vinet models.

  • eos_flow(atoms, relax_job, static_job, pre_relax=True, run_static=False, ...) optionally relaxes the bulk cell, then runs eos_subflow. It has the same shape as elastic_tensor_flow.
  • eos_subflow(undeformed_result, relax_job=None, static_job=None, ...) starts from an existing result. Each strained structure is relaxed at fixed cell (relax_cell=False) if relax_job is given, then run with static_job if given. The fit uses the static energies when available.
  • make_volume_strains_from_bulk in quacc.atoms.deformation scales the cell by (1 + s)^(1/3) with fractional coordinates fixed. The defaults are ±1.5% to ±7.5% volume in 10 steps.
  • EOSSchema is a generic return type, so the deformed results keep the schema of the jobs passed in (e.g. VaspSchema).
  • A ValueError is raised before any jobs launch if fewer than 4 points would be fit.
from ase.build import bulk

from quacc.recipes.common.eos import eos_flow
from quacc.recipes.emt.core import relax_job, static_job  # or any code's jobs

atoms = bulk("Cu")
result = eos_flow(atoms, relax_job, static_job)  # run_static=True recommended for VASP

fit = next(f for f in result["eos_doc"].eos if f.model.value == "birch_murnaghan")
print(f"V0 = {fit.V0:.3f} Å^3, B0 = {fit.B0:.1f} GPa")  # V0 = 11.566 Å^3, B0 = 134.3 GPa

Questions for maintainers

  1. Strain convention and range: we use zero-centered volumetric strains (-0.06), the same as ASE's calculate_eos eps, not scale factors (0.94). Our range (±7.5% volume) is narrower than atomate2's (±5% linear, about ±15% volume). Any preference?
  2. run_static default: it's False, matching elastic. For VASP, True is better because the relax's final energy is less accurate; for EMT and MLIPs the static repeats the last relax step.
  3. Per-code wrappers: none are included. Elastic has EMT and MLIP wrappers, so it appears in each code's docs. Should I add EMT/MLIP (and VASP?) wrappers here or in a follow-up?
  4. Generic EOSSchema: this is the first generic TypedDict in types.py. It follows Fix type annotations across recipes, runners, and schemas #3535's approach for common helpers like common/slabs.py. tests/typecheck/api.py covers it.

Add `eos_flow` and `eos_subflow` to `quacc.recipes.common.eos`. They
work with any calculator's relax and static jobs and fit the
energy-volume data with emmet's `EOSDoc`.

- `eos_flow` optionally relaxes the bulk cell (`pre_relax`), then runs
  `eos_subflow`. With `run_static`, statics follow the relaxations on
  the undeformed and volume-strained structures.
- `eos_subflow` takes the result of a prior calculation, generates
  isotropically volume-strained copies of its structure, and runs a
  fixed-cell relaxation (`relax_cell=False`) and/or a static on each.
  The fit uses the static energies when available.
- Add `quacc.atoms.deformation.make_volume_strains_from_bulk`, which
  scales the cell by (1 + volume_strain)^(1/3) with fractional
  coordinates fixed
- Add a generic `EOSSchema` type hint
- Raise a ValueError before launching any jobs if fewer than 4
  energy-volume points would be fit
@buildbot-princeton

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (88f951d) to head (9cef629).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #3552   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          103       104    +1     
  Lines         4548      4596   +48     
=========================================
+ Hits          4548      4596   +48     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Andrew-S-Rosen

Copy link
Copy Markdown
Member

Thanks, @dgaines2! I will try to review this weekend.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants