Skip to content

add phonons calculation entry point#266

Open
jap93 wants to merge 39 commits into
stfc:mainfrom
jap93:new
Open

add phonons calculation entry point#266
jap93 wants to merge 39 commits into
stfc:mainfrom
jap93:new

Conversation

@jap93

@jap93 jap93 commented Mar 5, 2026

Copy link
Copy Markdown

This is a pull request to include a phonon component into aiida-mlip. At present a phonopy.yaml file is passed back from janus-core to aiida-mlip. Further work will be to use hdf5 format to return force constants and include band structure.

@ElliottKasoar

ElliottKasoar commented Mar 6, 2026

Copy link
Copy Markdown
Member

Hi @jap93, thanks for this!

Assuming you would like us to start to review this, can you have a go at applying the pre-commit (see here) and ensuring the tests pass?

I think the tests are likely failing due to unpinning aiida-core (see #262 and the linked PR). While we certainly do need to unpin this, it requires additional fixes that @oerc0122 will hopefully contribute, so I wouldn't change it as part of this PR.

It would also be great if you could please try to revert any changes to unrelated files e.g. the singlepoint notebook tutorial.

@ElliottKasoar ElliottKasoar added the enhancement New/improved feature or request label Mar 6, 2026
@alinelena alinelena changed the title New add phonons calculation entry point Mar 10, 2026
@ajjackson

ajjackson commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

I think this should still be in "draft" mode? @jap93 if you look around the web interface there should be a "convert to draft" button somewhere on this page so Elliott knows it shouldn't get final review/merge yet.

Clearly the priority at the moment is to get the tests working!

I noticed

FAILED tests/calculations/test_phonon.py::test_output_files - AttributeError: module 'aiida_mlip.calculations.phonon' has no attribute 'Phonon'. Did you mean: 'Phonons'?

in the output which is probably a code error.

The JSON stuff seems more aiida internal and might be related to version incompatibilities. It looks like #262 which was "fixed" by pinning aiida-core.

@ajjackson ajjackson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I starting making some suggestions, mostly code style stuff. But noticed that some of these things should be caught by the ruff linter, and indeed there is a related CI failure here. https://github.com/stfc/aiida-mlip/actions/runs/23048418654/job/66943239378?pr=266

I think the preferred approach on aiida-mlip is to setup pre-commit hooks, so the code doesn't get committed without passing linting (and some automatic fixes can be applied). Did you run pre-commit install yet? https://github.com/stfc/aiida-mlip?tab=readme-ov-file#development

(If you need to commit in an emergency it is possible to skip with git commit --no-verify. I find that useful for saving work in progress and running for a bus, but would usually amend/rebase to fix the commit later...)

https://graphite.com/guides/git-commit-skip-hooks#how-to-skip-git-commit-hooks

Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread pyproject.toml Outdated
@ajjackson

Copy link
Copy Markdown
Contributor

I've tried rebasing this branch on main and reverting the aiida-core dependency to 2.7.1 (despite the yank...). With RabbitMQ 3.8.14 running this passes tests on my laptop.

@jap93 can you please rebase this on main and consider that dependency revert? Would be great to get a green pipeline so we can review properly.

@jap93

jap93 commented Mar 31, 2026 via email

Copy link
Copy Markdown
Author

Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/sp_parser.py Outdated
@ajjackson

Copy link
Copy Markdown
Contributor

@alinelena @ElliottKasoar I have done some preliminary code review and John P has implemented my suggestions. Would this be a good time from someone from aiida-mlip team to review?

Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread aiida_mlip/calculations/phonon.py Outdated
Comment thread examples/tutorials/workgraphs/simple_workgraph.ipynb
Comment thread tests/calculations/test_phonon.py
Comment thread tests/calculations/test_phonon.py Outdated
Comment thread tests/calculations/test_phonon.py
Comment thread .gitignore Outdated
@alinelena alinelena requested a review from oerc0122 April 21, 2026 15:03
Comment thread aiida_mlip/calculations/phonon.py Outdated
@ajjackson

Copy link
Copy Markdown
Contributor

@jap93 it looks like this PR needs rebasing to resolve conflicts and get the checks running again so we can finish review.

Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread examples/tutorials/calculations/singlepoint.ipynb
Comment thread examples/tutorials/workgraphs/simple_workgraph.ipynb
@ajjackson

Copy link
Copy Markdown
Contributor

@oerc0122 @jap93 is this ready for another round of review? We'll need this merged to simplify distribution of an AiiDAlab prototype to users.

Comment thread examples/calculations/submit_phonon.py
Comment thread examples/calculations/submit_phonon.py

@oerc0122 oerc0122 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Needs a rebase first and a couple of suggestions. This is pretty much there.

@ElliottKasoar ElliottKasoar left a comment

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.

Hi @jap93, thanks for all of this, it's looking great! Most of the comments I've left are very minor things to tidy up. Please do make sure the examples/tutorials all run with the latest changes you make.

One slightly larger question is about the options we don't present. I know there's been discussion about geometry optimisation, which makes sense as we can use the actual calcjob for that, but there are options such as the thermal properties and DOS/PDOS kwargs that are also not exposed.

Has this been discussed? Generally the guidance for plugins is not to limit users more than they are in the underling code.

A simple option would be to have something similar to MD where we permit an extra set of arbitrary kwargs that we then pass on, or is there a reason not to support these?

I suggest you mark comments from myself and others as "resolved" unless there's anything you're not sure about, since we'll need to close all of these before this is merged.

Comment thread aiida_mlip/parsers/ph_parser.py Outdated
Comment thread examples/calculations/submit_phonon.py Outdated
Comment thread tests/calculations/test_phonon.py Outdated
Comment thread tests/calculations/test_phonon.py Outdated
Comment thread tests/calculations/test_phonon.py Outdated
Comment thread docs/source/user_guide/calculations.rst Outdated
Comment thread examples/calculations/submit_phonon.py
Comment thread examples/tutorials/workgraphs/geom_phonon.ipynb Outdated
Comment thread examples/tutorials/workgraphs/geom_phonon.ipynb Outdated
Comment thread examples/tutorials/workgraphs/geom_phonon.ipynb
@jap93

jap93 commented Jun 29, 2026 via email

Copy link
Copy Markdown
Author

@ajjackson

Copy link
Copy Markdown
Contributor

Right, the priority to support other projects is to get force constants and then do property calculations with Euphonic rather than do everything with Phonopy in one go.

That said, it is a little bit odd to produce bands and not DOS, because for systems with many atoms in primitive cell the DOS is the more intelligible representation of the data. The thermochemistry outputs are used much less and I don't expect they'll be missed for a while.

jap93 and others added 15 commits June 30, 2026 08:33
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
Co-authored-by: Elliott Kasoar <45317199+ElliottKasoar@users.noreply.github.com>
@ElliottKasoar

Copy link
Copy Markdown
Member

Hi @jap93, thanks for all of the fixes.

A few of the threads marked as resolved don't seem to have included any changes. I haven't gone through all of them, but, for example, the input spec still seems to include properties, and there are still unexpected changes to the singlepoint tutorial notebook.

Did you push all of your changes?

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

Labels

enhancement New/improved feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants