Adding relax workflow for ABACUS - #349
Conversation
Added LCAO protocols
…orkflows into feature/abacus
t-reents
left a comment
There was a problem hiding this comment.
Hi @zhubonan
Sorry for checking it only now, but I just saw it by chance (since only @giovannipizzi was tagged for a review).
First of all, thanks again for your contribution!
I checked the PR and there are a few things to discuss/adapt, see my comments below. Let me know if you have questions and my comments are not clear
| from ..workchain import CommonRelaxWorkChain | ||
| from .generator import AbacusCommonRelaxInputGenerator | ||
|
|
||
| __all__ = ('AbacusCommonRelaxInputGenerator',) |
There was a problem hiding this comment.
This should be the following, no?
| __all__ = ('AbacusCommonRelaxInputGenerator',) | |
| __all__ = ('AbacusCommonRelaxWorkChain',) |
| # Default to use the free energy (E_KohnSham - TS) since it is consistent with the | ||
| # forces and is also used by the ACWF verification project | ||
| total_energy = misc.base.attributes.get('total_energy') | ||
| total_magnetization = misc.base.attributes.get('total_magnetization', None) | ||
|
|
||
| results = {'total_energy': orm.Float(total_energy)} # The reported energy is eV | ||
|
|
||
| # Get the forces and stress, abacus report these values in eV/A and KBar | ||
| forces = np.array(misc['final_forces']) | ||
| forces = orm.ArrayData({'forces': forces}) | ||
| stress = np.array(misc['final_stress']) / 10 # Convert to GPa | ||
| stress = orm.ArrayData({'stress': stress}) | ||
|
|
||
| if total_magnetization is not None: | ||
| results['total_magnetization'] = orm.Float(total_magnetization) | ||
|
|
||
| return {'total_energy': orm.Float(total_energy), 'forces': forces, 'stress': stress} |
There was a problem hiding this comment.
The results dict is created and updated with the total_magnetization but never used. A new "unrelated" dict is returned, which also misses the magnetic information
| @@ -0,0 +1,60 @@ | |||
| from aiida import orm | |||
There was a problem hiding this comment.
I guess this file should be entirely removed, right?
|
|
||
|
|
||
| def get_ts_energy(common_relax_workchain: AbacusCommonRelaxWorkChain) -> float: | ||
| """Return the T * S value of a concluded ``QuantumEspressoCommonRelaxWorkChain``. |
There was a problem hiding this comment.
Doc-string needs to be updated
| # else: | ||
| # initial_magnetic_moments = dict(kind_to_magnetization) | ||
| # else: | ||
| initial_magnetic_moments = None |
There was a problem hiding this comment.
Is magnetism not supported in abacus? According to the documentation, it does? https://aiida-abacus.readthedocs.io/en/latest/howto/calculations.html#id2
There was a problem hiding this comment.
I think that the magnetization shouldn't be silently ignored
| @@ -0,0 +1,56 @@ | |||
| """Implementation of `aiida_common_workflows.common.relax.workchain.CommonRelaxWorkChain` for Quantum ESPRESSO.""" | |||
|
|
||
|
|
||
| class AbacusCommonRelaxWorkChain(CommonRelaxWorkChain): | ||
| """Implementation of `aiida_common_workflows.common.relax.workchain.CommonRelaxWorkChain` for Quantum ESPRESSO.""" |
| @@ -0,0 +1,29 @@ | |||
| """ | |||
| Post-processing extractor functions for the ``QuantumEspressoCommonRelaxWorkChain``. | |||
| The ports defined on the specification are the inputs that will be accepted by the ``get_builder`` method. | ||
| """ | ||
| super().define(spec) | ||
| spec.inputs['protocol'].valid_type = ChoiceType(('fast', 'moderate', 'precise', 'verification-PBE-v1')) |
There was a problem hiding this comment.
This is overwritten in the next line
| spec.inputs['protocol'].valid_type = ChoiceType(('fast', 'moderate', 'precise', 'verification-PBE-v1')) |
This PR adds the relaxation workflow for ABACUS which has been used to generate the contributed verification data on the Materials Cloud (https://archive.materialscloud.org/record/2025.151).