monkeypatch_aims

atomate2.utils.testing.aims.monkeypatch_aims(monkeypatch, ref_path)[source]

Allow one to mock (fake) running FHI-aims.

To use the fixture successfully, the following steps must be followed: 1. “mock_aims” should be included as an argument to any test that would like to use

its functionally.

  1. For each job in your workflow, you should prepare a reference directory containing two folders “inputs” (containing the reference input files expected to be produced by write_aims_input_set) and “outputs” (containing the expected output files to be produced by run_aims). These files should reside in a subdirectory of “tests/test_data/aims”.

  2. Create a dictionary mapping each job name to its reference directory. Note that you should supply the reference directory relative to the “tests/test_data/aims” folder. For example, if your calculation has one job named “static” and the reference files are present in “tests/test_data/aims/Si_static”, the dictionary would look like: {"static": "Si_static"}.

  3. Optional (does not work yet): create a dictionary mapping each job name to custom keyword arguments that will be supplied to fake_run_aims. This way you can configure which control.in settings are expected for each job. For example, if your calculation has one job named “static” and you wish to validate that “xc” is set correctly in the control.in, your dictionary would look like {"static": {"input_settings": {"relativistic": "atomic_zora scalar"}}.

  4. Inside the test function, call mock_aims(ref_paths, fake_aims_kwargs), where ref_paths is the dictionary created in step 3 and fake_aims_kwargs is the dictionary created in step 4.

  5. Run your aims job after calling mock_aims.

For examples, see the tests in tests/aims/jobs/core.py.

Parameters:
  • monkeypatch (MonkeyPatch)

  • ref_path (Path)

Return type:

Generator[Callable[[Any, Any], Any], None, None]