-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Q2rCalculation
: Fix copying from parent_folder
When providing a `RemoteData` node as a `parent_folder` to the `Q2rCalculation`, the contents of the `out` folder are now copied to the `DYN_MAT` folder for the `q2r.x` calculation. This is because for `RemoteData` input the `_default_parent_output_folder` is used, which is defined as `out` for the parent `NamelistsCalculation` class, but not overriden by `Q2rCalculation`. Here we override the `_default_parent_output_folder` class variable so the contents of the `DYN_MAT` folder are also copied when a `RemoteData` input is provided.
- Loading branch information
Showing
4 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Tests for the `Q2rCalculation` class.""" | ||
# pylint: disable=protected-access | ||
from pathlib import Path | ||
|
||
from aiida.common import datastructures | ||
|
||
from aiida_quantumespresso.calculations.ph import PhCalculation | ||
from aiida_quantumespresso.calculations.q2r import Q2rCalculation | ||
|
||
|
||
def test_q2r_default(fixture_sandbox, generate_calc_job, generate_inputs_q2r, file_regression): | ||
"""Test a default `Q2rCalculation`.""" | ||
entry_point_name = 'quantumespresso.q2r' | ||
|
||
inputs = generate_inputs_q2r() | ||
calc_info = generate_calc_job(fixture_sandbox, entry_point_name, inputs) | ||
parent_folder = inputs['parent_folder'] | ||
remote_copy_folder = Path(parent_folder.get_remote_path()) / PhCalculation._FOLDER_DYNAMICAL_MATRIX | ||
|
||
remote_copy_list = [(parent_folder.computer.uuid, str(remote_copy_folder), PhCalculation._FOLDER_DYNAMICAL_MATRIX)] | ||
retrieve_list = [Q2rCalculation._DEFAULT_OUTPUT_FILE] + Q2rCalculation._internal_retrieve_list | ||
|
||
# Check the attributes of the returned `CalcInfo` | ||
assert isinstance(calc_info, datastructures.CalcInfo) | ||
assert sorted(calc_info.remote_copy_list) == sorted(remote_copy_list) | ||
assert sorted(calc_info.retrieve_list) == sorted(retrieve_list) | ||
|
||
with fixture_sandbox.open('aiida.in') as handle: | ||
input_written = handle.read() | ||
|
||
# Checks on the files written to the sandbox folder as raw input | ||
assert sorted(fixture_sandbox.get_content_list()) == sorted(['aiida.in']) | ||
file_regression.check(input_written, encoding='utf-8', extension='.in') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
&INPUT | ||
fildyn = 'DYN_MAT/dynamical-matrix-' | ||
flfrc = 'real_space_force_constants.dat' | ||
/ |