Because the meaning of ibrav=-13 changed in QE version 6.4.1, this adds a way of dealing with different QE versions:
The parse_version function turns a string (e.g. '6.4.1') into a packaging.version.Version. By default the latest version is used, which is implemented as a singleton object that compares as greater than any Version object.
In the interface, the version can be specified as the optional keyword-only argument qe_version. Because this option needs to be available both at the top-level QeInputFile.__init__ and on the free functions (e.g. get_cell_from_parameters), it accepts either a string or an already-parsed version. This allows immediately parsing the version in QeInputFile.__init__, while also accepting string input in get_cell_from_parameters.
The way this is implemented is by making the parse_version idempotent, meaning that it will not change an already-parsed version.
In the tests, the qe_version can be passed as a keyword to singletest. However, these tests currently cannot auto-generate the reference file.
Dependency changes:
Uses pytest as a test runner (haven't modified the existing tests yet, but these could potentially be simplified a lot with pytest-regressions)
Adds packaging as an explicit dependency. Since this is part of the standard Python tooling (via setuptools) it should usually be installed already anyway.
To be reviewed especially carefully:
[x] The logic for ibrav = 91/-13 matches the pw.x input description
[x] The public interface change of adding the qe_version keyword-only argument. The other changes (adding parse_version etc.) are internal-only.
Fixes #28.
Because the meaning of
ibrav=-13
changed in QE version 6.4.1, this adds a way of dealing with different QE versions:The
parse_version
function turns a string (e.g.'6.4.1'
) into apackaging.version.Version
. By default the latest version is used, which is implemented as a singleton object that compares as greater than anyVersion
object.In the interface, the version can be specified as the optional keyword-only argument
qe_version
. Because this option needs to be available both at the top-levelQeInputFile.__init__
and on the free functions (e.g.get_cell_from_parameters
), it accepts either a string or an already-parsed version. This allows immediately parsing the version inQeInputFile.__init__
, while also accepting string input inget_cell_from_parameters
.The way this is implemented is by making the
parse_version
idempotent, meaning that it will not change an already-parsed version.In the tests, the
qe_version
can be passed as a keyword tosingletest
. However, these tests currently cannot auto-generate the reference file.Dependency changes:
pytest
as a test runner (haven't modified the existing tests yet, but these could potentially be simplified a lot withpytest-regressions
)packaging
as an explicit dependency. Since this is part of the standard Python tooling (viasetuptools
) it should usually be installed already anyway.To be reviewed especially carefully:
pw.x
input descriptionqe_version
keyword-only argument. The other changes (addingparse_version
etc.) are internal-only.