Skip to content

Add Debye-Waller factors as an option of the phonon makers - #1580

Open
hrushikesh-s wants to merge 55 commits into
materialsproject:mainfrom
hrushikesh-s:debye-waller
Open

hrushikesh-s wants to merge 55 commits into
materialsproject:mainfrom
hrushikesh-s:debye-waller

Conversation

@hrushikesh-s

@hrushikesh-s hrushikesh-s commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Include a summary of major changes in bullet points:

Additional dependencies introduced (if any)

  • List all new dependencies needed and justify why. While adding dependencies that bring
    significantly useful functionality is perfectly fine, adding ones that add trivial
    functionality, e.g., to use one single easily implementable function, is frowned upon.
    Justify why that dependency is needed. Especially frowned upon are circular dependencies.

  • Needs pymatgen 2026.10.24 or newer, the first release with the anisotropic Debye-Waller factors of Add anisotropic Debye-Waller factors to XRDCalculator, NDCalculator and TEMCalculator pymatgen#4715. The new debye-waller extra installs it, so the other workflows keep the current pymatgen lower bound.

  • CI installs the extra in a separate step, since the strict extras pin an older pymatgen. A new matrix entry runs only the Debye-Waller tests.

TODO (if any)

If this is a work-in-progress, write something about what else needs to be done.

Checklist

Work-in-progress pull requests are encouraged, but please put [WIP] in the pull request
title.

Before a pull request can be merged, the following items must be checked:

  • Code is in the standard Python style.
    The easiest way to handle this is to run the following in the correct sequence on
    your local machine. Start with running ruff and ruff format on your new code. This will
    automatically reformat your code to PEP8 conventions and fix many linting issues.
  • Doc strings have been added in the Numpy docstring format.
    Run ruff on your code.
  • Type annotations are highly encouraged. Run mypy to
    type check your code.
  • Tests have been added for any new functionality or bug fixes.
  • All linting and tests pass.

Note that the CI system will run all the above checks. But it will be much more
efficient if you already fix most errors prior to submitting the PR. It is highly
recommended that you use the pre-commit hook provided in the repository. Simply run
pre-commit install and a check will be run prior to allowing commits.

@hrushikesh-s hrushikesh-s added phonon Phonon workflow related new wf PRs with new workflows labels Oct 8, 2026
@JaGeo

JaGeo commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Could you check the frequency_cutoff and convergence with q points?

11 years ago, I did some relevant tests: https://doi.org/10.1039/c5ce01219h

EDIT:
I now reread the description that phonopy is not used in this context.
I would be interested in a comparison between this method and phonopy's with frequency_cutoff.

@JaGeo

JaGeo commented Oct 8, 2026

Copy link
Copy Markdown
Member

Also, there is a bit of a disconnect now. The phonon workflow already has an option to compute thermal displacement parameters and can save it as well

class ThermalDisplacementData(BaseModel):

@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

Could you check the frequency_cutoff and convergence with q points?

11 years ago, I did some relevant tests: https://doi.org/10.1039/c5ce01219h

EDIT: I now reread the description that phonopy is not used in this context. I would be interested in a comparison between this method and phonopy's with frequency_cutoff.

@JaGeo, yes, I am still running the benchmarking and comparison tests for this workflow from @rkeesey.
I will post the results here once they are ready and are properly checked from my end.

Also, there is a bit of a disconnect now. The phonon workflow already has an option to compute thermal displacement parameters and can save it as well

Yes, let me look into this as well...

@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

Could you check the frequency_cutoff and convergence with q points?

11 years ago, I did some relevant tests: https://doi.org/10.1039/c5ce01219h

EDIT: I now reread the description that phonopy is not used in this context. I would be interested in a comparison between this method and phonopy's with frequency_cutoff.

With a cutoff of 0 THz on the default q-point mesh, the acoustic modes at Gamma made U far too large or crashed phonopy, and U converges only as 1/N with the mesh number N. I fixed this for all phonon workflows in #1590, with a benchmark on 51 materials, and #1580 now takes U directly from the phonon flow, so there is no second implementation and no separate frequency_cutoff. Does this make sense?

@hrushikesh-s hrushikesh-s changed the title Add a Debye-Waller workflow Add Debye-Waller factors as an option of the phonon makers Oct 12, 2026
@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

The tutorial in #1592 now also uses this option, and its rerun gives the same results for the six materials.

@rkeesey

rkeesey commented Oct 14, 2026

Copy link
Copy Markdown

@hrushikesh-s Phonopy's default TDM matrices use Cartesian coordinates, and the CIF convention is only applied when specifically requested (the YAML files with the TDMs in the phonon database include both conventions). Would it be beneficial to implement a method of DWF calculation using Cartesian coordinates as well?

@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

@hrushikesh-s Phonopy's default TDM matrices use Cartesian coordinates, and the CIF convention is only applied when specifically requested (the YAML files with the TDMs in the phonon database include both conventions). Would it be beneficial to implement a method of DWF calculation using Cartesian coordinates as well?

@rkeesey, thanks! The Debye-Waller job already starts from phonopy’s Cartesian U, and its output stores both conventions. It converts U to the CIF convention only because pymatgen’s XRD, ND, and TEM calculators read the U11_cif to U12_cif site properties. Both are the same tensor in different bases, so the factors match exp(-2π² gᵀUg) from the Cartesian U to machine precision, which I checked on a triclinic cell.

@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

Or would you rather have it as an option of the phonon makers? Then the phonopy, pheasy, and hiPhive makers, and every new phonon maker, would each need the option in their own make(). Until a pymatgen release has materialsproject/pymatgen#4715, all phonon flows would also depend on it. Or is there something else that you suggest to do instead?

I had this in mind. However, the options would be part of the initialisation. I would anyhow recommend that we wait with merging until a new pymatgen release exists.

@JaGeo, materialsproject/pymatgen#4715 is now merged.

@ZKC19940412

Copy link
Copy Markdown

When reviewing this PR, I noticed the Debye-Waller document embeds a full copy of the phonon document's thermal displacement data: from_phonon_doc stores data.model_dump() here (L170), and the EMT test (tests/forcefields/flows/test_debye_waller.py L63-65) asserts the two copies are identical. Can you confirm the dual copy in storage is intended by design? If so, a short note in the field description would preempt the
question for future users.

@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

When reviewing this PR, I noticed the Debye-Waller document embeds a full copy of the phonon document's thermal displacement data: from_phonon_doc stores data.model_dump() here (L170), and the EMT test (tests/forcefields/flows/test_debye_waller.py L63-65) asserts the two copies are identical. Can you confirm the dual copy in storage is intended by design? If so, a short note in the field description would preempt the question for future users.

Yes, the copy is on purpose. The patterns are listed per temperature of this data, and the Debye-Waller document has no other temperatures, so it needs the copy to be read on its own. I have added this to the field description. Does that look fine?

@hrushikesh-s

Copy link
Copy Markdown
Collaborator Author

@JaGeo, #1590 is merged, so this PR now has only the Debye-Waller changes and is up to date with main. It is ready for review.

Comment thread docs/user/codes/vasp.md Outdated
The Debye-Waller factor of a site for the reciprocal lattice vector $g$, with $|g| = 1/d_{hkl}$, is $\exp(-2\pi^2 g^T U g)$.
For an isotropic $U = U_\mathrm{iso} I$, this is $\exp(-B s^2)$ with $B = 8\pi^2 U_\mathrm{iso}$ and $s = |g|/2$.
The patterns are computed at each temperature of $U$, from 0 K to 1000 K in steps of 100 K by default, and once without the factors.
The phonon frequencies are not renormalized with temperature.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess one can use this with any of the harmonic phonon approaches right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, create_debye_waller is an option of the base phonon maker, so the phonopy, pheasy, and hiPhive makers all have it.

The pheasy and hiPhive flows build emmet’s phonon document, though, which does not store the primitive cell of the matrices yet. So for them, the compute_debye_waller job fails until materialsproject/emmet#1536 is released....

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is true, i don't understand the sentence about the T renormalization

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence only means that $U$ at every temperature comes from the same harmonic phonons, so the change of the phonon frequencies with temperature is not included. That holds for all harmonic phonon makers. I have reworded it that way in the docs. Does it read better now?

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

new wf PRs with new workflows phonon Phonon workflow related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants