From eaf5b84400901a563460e2e2ba402de0f4fd55e4 Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Tue, 2 Apr 2024 14:29:18 +0200 Subject: [PATCH] Fix mypy --- src/nomad_simulations/outputs.py | 12 ++++++++---- tests/test_outputs.py | 12 ++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/nomad_simulations/outputs.py b/src/nomad_simulations/outputs.py index 0cfe2432..56f93ed1 100644 --- a/src/nomad_simulations/outputs.py +++ b/src/nomad_simulations/outputs.py @@ -177,7 +177,9 @@ class SCFOutputs(Outputs): ) # TODO add more functionality to automatically check convergence from `self_consistency_ref` and the last `scf_step[-1]` - def check_is_converged(self, is_converged: bool, logger: BoundLogger) -> bool: + def check_is_scf_converged( + self, is_scf_converged: bool, logger: BoundLogger + ) -> bool: """ Check if the output property is converged or not. @@ -188,8 +190,8 @@ def check_is_converged(self, is_converged: bool, logger: BoundLogger) -> bool: Returns: (bool): The flag indicating whether the output property is converged or not. """ - if not is_converged: - logger.info('The output property is not converged.') + if not is_scf_converged: + logger.info('The output property is not converged after the SCF process.') return False return True @@ -197,4 +199,6 @@ def normalize(self, archive, logger) -> None: super().normalize(archive, logger) # Set if the output property `is_converged` or not. - self.is_converged = self.check_is_converged(self.is_converged, logger) + self.is_scf_converged = self.check_is_scf_converged( + self.is_scf_converged, logger + ) diff --git a/tests/test_outputs.py b/tests/test_outputs.py index f9e4fe10..97ef94be 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -56,19 +56,19 @@ class TestOutputs: """ @pytest.mark.parametrize( - 'is_converged, result', + 'is_scf_converged, result', [ (False, False), (True, True), ], ) - def test_normalize(self, is_converged, result): + def test_normalize(self, is_scf_converged, result): """ Test the `normalize` method. """ scf_outputs = SCFOutputs() - # ! This testing is repetivite, but `check_is_converged` should eventually contain more complex logic and be separated in its own testing method. - assert scf_outputs.check_is_converged(is_converged, logger) == result - scf_outputs.is_converged = is_converged + # ! This testing is repetivite, but `check_is_scf_converged` should eventually contain more complex logic and be separated in its own testing method. + assert scf_outputs.check_is_scf_converged(is_scf_converged, logger) == result + scf_outputs.is_scf_converged = is_scf_converged scf_outputs.normalize(None, logger) - assert scf_outputs.is_converged == result + assert scf_outputs.is_scf_converged == result