Skip to content

New factories for phonons workflow in atomate2#389

Merged
gmatteo merged 52 commits intoabinit:developfrom
emarazzi:phonons_atomate2
Feb 13, 2026
Merged

New factories for phonons workflow in atomate2#389
gmatteo merged 52 commits intoabinit:developfrom
emarazzi:phonons_atomate2

Conversation

@emarazzi
Copy link
Contributor

The PR introduces 2 new factories to handle inputs generation for:

  • wfq_nscf_from_gsinput
  • phononpert_from_gsinput for a phonon calculation on a single perturbation, along with the corresponding method in abio.inputs.

VicTrqt and others added 30 commits February 22, 2023 14:38
Copilot AI review requested due to automatic review settings February 13, 2026 10:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces two new factory functions for generating Abinit inputs for phonon-related calculations in atomate2 workflows. The changes add capabilities to create inputs for NSCF calculations on K+Q grids and for single phonon perturbation calculations, along with the underlying input generation method.

Changes:

  • Added make_phpert_input method in AbinitInput class to generate inputs for phonon perturbation calculations
  • Added wfq_nscf_from_gsinput factory function to create NSCF inputs on K+Q grids
  • Added phononpert_from_gsinput factory function to create single phonon perturbation inputs
  • Modified scf_for_phonons to make nbdbuf a configurable parameter and improve smearing handling logic

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

File Description
abipy/abio/inputs.py Adds make_phpert_input method to generate Abinit input for a single phonon perturbation using DFPT
abipy/abio/factories.py Adds wfq_nscf_from_gsinput factory for K+Q grid NSCF calculations and phononpert_from_gsinput factory for single phonon perturbation inputs; updates scf_for_phonons to allow configurable nbdbuf and improved smearing condition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1496 to +1501
Returns an |AbinitInput| to perform a BEC calculations for a specific perturbation based on a ground state |AbinitInput|.

Args:
gs_input: an |AbinitInput| representing a ground state calculation, likely the SCF performed to get the WFK.
phonon_pert: dict with the Abinit variables defining the perturbation
Example: {'idir': 1, 'ipert': 4, 'qpt': [0.0, 0.0, 0.0]},
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The docstring is missing documentation for the phonon_tol parameter. Similar functions like ddepert_from_gsinput (line 1448) properly document all parameters including the tolerance parameter. The docstring should include documentation for phonon_tol explaining it's a dictionary with a single key defining the type of tolerance and its value, with a default of {"tolvrs": 1.0e-10}.

Suggested change
Returns an |AbinitInput| to perform a BEC calculations for a specific perturbation based on a ground state |AbinitInput|.
Args:
gs_input: an |AbinitInput| representing a ground state calculation, likely the SCF performed to get the WFK.
phonon_pert: dict with the Abinit variables defining the perturbation
Example: {'idir': 1, 'ipert': 4, 'qpt': [0.0, 0.0, 0.0]},
Returns an |AbinitInput| to perform a phonon (DFPT) calculation for a specific perturbation based on a ground
state |AbinitInput|.
Args:
gs_input: an |AbinitInput| representing a ground state calculation, likely the SCF performed to get the WFK.
phonon_pert: dict with the Abinit variables defining the perturbation
Example: {'idir': 1, 'ipert': 4, 'qpt': [0.0, 0.0, 0.0]},
phonon_tol: dict specifying the DFPT convergence tolerance. It should contain a single key defining the
type of tolerance (e.g., "tolvrs") and its numerical value. If None, a default of {"tolvrs": 1.0e-10}
is used.

Copilot uses AI. Check for mistakes.
return inp


def make_phpert_input(self, perturbation, tolerance = None, prtwf = -1, prepgkk = 0, manager=None) -> AbinitInput:
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The prepgkk parameter is defined but never used in the function body. Unlike the similar make_ph_inputs_qpoint method which passes prepgkk to abiget_irred_phperts, this method doesn't use it anywhere. Either this parameter should be removed from the signature, or it should be passed to the appropriate location if it's needed.

Copilot uses AI. Check for mistakes.

return nscf_input

def wfq_nscf_from_gsinput(gs_input, qpt, kppa=None, nband = None, accuracy="high",
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The parameter spacing around = doesn't match the codebase convention. Throughout factories.py, parameters use parameter=None (no spaces) rather than parameter = None (with spaces). This applies to nband in this function signature.

Copilot uses AI. Check for mistakes.
emarazzi and others added 2 commits February 13, 2026 14:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gmatteo
Copy link
Member

gmatteo commented Feb 13, 2026

Thanks

@gmatteo gmatteo merged commit 463f98f into abinit:develop Feb 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants