New factories for phonons workflow in atomate2#389
Conversation
pull trunk develop
pull trunk develop
pull trunk develop
pull trunk develop
pull trunk develop
merge develop
pull trunk develop
pull trunk develop
pull trunk develop
…nit_dfpt pull enrico fix tol
Abinit dfpt atomate2
pull trunk develop
update abinit dfpt atomate2
There was a problem hiding this comment.
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_inputmethod inAbinitInputclass to generate inputs for phonon perturbation calculations - Added
wfq_nscf_from_gsinputfactory function to create NSCF inputs on K+Q grids - Added
phononpert_from_gsinputfactory function to create single phonon perturbation inputs - Modified
scf_for_phononsto makenbdbufa 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.
abipy/abio/factories.py
Outdated
| 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]}, |
There was a problem hiding this comment.
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}.
| 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. |
abipy/abio/inputs.py
Outdated
| return inp | ||
|
|
||
|
|
||
| def make_phpert_input(self, perturbation, tolerance = None, prtwf = -1, prepgkk = 0, manager=None) -> AbinitInput: |
There was a problem hiding this comment.
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.
abipy/abio/factories.py
Outdated
|
|
||
| return nscf_input | ||
|
|
||
| def wfq_nscf_from_gsinput(gs_input, qpt, kppa=None, nband = None, accuracy="high", |
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thanks |
The PR introduces 2 new factories to handle inputs generation for: