Skip to content

Commit

Permalink
Fix parsing for different cases and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbercx committed Apr 5, 2023
1 parent 9c2fb2c commit 3d934f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/aiida_quantumespresso/parsers/pw.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def is_ionically_converged(self, trajectory, except_final_scf=False):
:param trajectory: the output trajectory data
:param except_final_scf: if True will return whether the calculation is converged except for the final scf.
"""
from aiida_quantumespresso.calculations import _uppercase_dict
from aiida_quantumespresso.utils.defaults.calculation import pw
from aiida_quantumespresso.utils.validation.trajectory import verify_convergence_trajectory

Expand All @@ -236,7 +237,10 @@ def is_ionically_converged(self, trajectory, except_final_scf=False):
threshold_stress = parameters.get('CELL', {}).get('press_conv_thr', pw.press_conv_thr)
external_pressure = parameters.get('CELL', {}).get('press', 0)

fixed_coords = self.node.inputs.settings.get_dict().get('fixed_coords', None)
if 'settings' in self.node.inputs:
settings = _uppercase_dict(self.node.inputs.settings.get_dict(), dict_name='settings')

fixed_coords = settings.get('FIXED_COORDS', None)

# Through the `cell_dofree` the degrees of freedom of the cell can be constrained, which makes the threshold on
# the stress hard to interpret. Therefore, unless the `cell_dofree` is set to the default `all` where the cell
Expand Down
7 changes: 5 additions & 2 deletions tests/parsers/test_pw.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,10 @@ def test_pw_npools_too_high_not_error(fixture_localhost, generate_calc_job_node,


@pytest.mark.parametrize('calculation', ('relax', 'vc-relax'))
def test_fixed_coords(fixture_localhost, generate_calc_job_node, generate_parser, generate_inputs, calculation):
@pytest.mark.parametrize('settings_key', ('fixed_coords', 'FIXED_COORDS'))
def test_fixed_coords(
fixture_localhost, generate_calc_job_node, generate_parser, generate_inputs, calculation, settings_key
):
"""Test the parsing of a successful calculation that has specified a ``fixed_coords`` setting.
The output files of this test were generated for a calculation of a FCC Si supercell where
Expand All @@ -414,7 +417,7 @@ def test_fixed_coords(fixture_localhost, generate_calc_job_node, generate_parser
entry_point_parser = 'quantumespresso.pw'

inputs = generate_inputs(
calculation_type=calculation, settings={'fixed_coords': [[True, True, True], [True, True, False]]}
calculation_type=calculation, settings={settings_key: [[True, True, True], [True, True, False]]}
)
node = generate_calc_job_node(entry_point_calc_job, fixture_localhost, name, inputs)
parser = generate_parser(entry_point_parser)
Expand Down

0 comments on commit 3d934f8

Please sign in to comment.