|
4 | 4 | import mala |
5 | 5 | import numpy as np |
6 | 6 | import pytest |
| 7 | +import runpy |
7 | 8 |
|
8 | 9 | from mala.datahandling.data_repo import data_path_be, data_path_bao |
9 | 10 |
|
@@ -115,7 +116,7 @@ def test_preprocessing(self): |
115 | 116 | "ldos_gridoffset_ev": [-19, -10.5, -4.5, 3.5], |
116 | 117 | "data_path_be": data_path_bao, |
117 | 118 | "correct_input_shape": (48, 48, 48, 33), |
118 | | - "correct_output_shape": (48, 48, 48, 53), |
| 119 | + "correct_output_shape": (48, 48, 48, 64), |
119 | 120 | } |
120 | 121 |
|
121 | 122 | for system in ["Be", "BaO"]: |
@@ -469,37 +470,50 @@ def test_total_energy_from_ldos(self): |
469 | 470 | atol=accuracy_total_energy, |
470 | 471 | ) |
471 | 472 |
|
472 | | - @pytest.mark.skipif( |
473 | | - importlib.util.find_spec("total_energy") is None, |
474 | | - reason="QE is currently not part of the pipeline.", |
475 | | - ) |
476 | | - def test_total_energy_from_ldos_multielement(self): |
477 | | - """ |
478 | | - Test whether MALA can calculate the total energy using the LDOS. |
479 | | -
|
480 | | - This means calculating energies from the LDOS. This is the |
481 | | - test for multiple elements. We can not test multiple systems in the |
482 | | - same test due to QE not being able to deinitialize via our interface. |
483 | | -
|
484 | | - """ |
485 | | - # Set up parameters. |
486 | | - ldos, ldos_data = self.load_ldos(system="BaO") |
487 | | - |
488 | | - # Calculate energies |
489 | | - self_consistent_fermi_energy = ldos.get_self_consistent_fermi_energy( |
490 | | - ldos_data |
491 | | - ) |
492 | | - total_energy = ldos.get_total_energy( |
493 | | - ldos_data, fermi_energy=self_consistent_fermi_energy |
494 | | - ) |
495 | | - assert np.isclose( |
496 | | - total_energy, |
497 | | - ldos.total_energy_dft_calculation, |
498 | | - # The total energy is really difficult to get accurately in the |
499 | | - # multielement case with the limited LDOS sampling fidelity we |
500 | | - # are using. |
501 | | - atol=accuracy_total_energy * 3300, |
502 | | - ) |
| 473 | + # TODO: We currently have to skip that because we cannot call the |
| 474 | + # TEM twice with a different system. |
| 475 | + |
| 476 | + # @pytest.mark.skipif( |
| 477 | + # importlib.util.find_spec("total_energy") is None, |
| 478 | + # reason="QE is currently not part of the pipeline.", |
| 479 | + # ) |
| 480 | + # def test_total_energy_from_ldos_multielement(self): |
| 481 | + # """ |
| 482 | + # Test whether MALA can calculate the total energy using the LDOS. |
| 483 | + # |
| 484 | + # This means calculating energies from the LDOS. This is the |
| 485 | + # test for multiple elements. We can not test multiple systems in the |
| 486 | + # same test due to QE not being able to deinitialize via our interface. |
| 487 | + # Therefore, we have to run this test in a separate process. |
| 488 | + # """ |
| 489 | + # # Set up parameters. |
| 490 | + # ldos, ldos_data = self.load_ldos(system="BaO") |
| 491 | + # |
| 492 | + # # Create a target calculator to perform postprocessing. |
| 493 | + # ldos = mala.Target(test_parameters) |
| 494 | + # ldos.read_additional_calculation_data( |
| 495 | + # os.path.join(data_path_bao, "BaO_snapshot0.out"), |
| 496 | + # "espresso-out", |
| 497 | + # ) |
| 498 | + # ldos_data = np.load( |
| 499 | + # os.path.join(data_path_bao, "BaO_snapshot0.out.npy") |
| 500 | + # ) |
| 501 | + # |
| 502 | + # # Calculate energies |
| 503 | + # self_consistent_fermi_energy = ldos.get_self_consistent_fermi_energy( |
| 504 | + # ldos_data |
| 505 | + # ) |
| 506 | + # total_energy = ldos.get_total_energy( |
| 507 | + # ldos_data, fermi_energy=self_consistent_fermi_energy |
| 508 | + # ) |
| 509 | + # assert np.isclose( |
| 510 | + # total_energy, |
| 511 | + # ldos.total_energy_dft_calculation, |
| 512 | + # # The total energy is really difficult to get accurately in the |
| 513 | + # # multielement case with the limited LDOS sampling fidelity we |
| 514 | + # # are using. |
| 515 | + # atol=accuracy_total_energy * 330, |
| 516 | + # ) |
503 | 517 |
|
504 | 518 | @pytest.mark.skipif( |
505 | 519 | importlib.util.find_spec("total_energy") is None, |
|
0 commit comments