aiidateam / qe-tools

A set of useful tools for Quantum ESPRESSO
MIT License
28 stars 13 forks source link

Add handling for ibrav=91/-13 to 'cell_from_parameters'. #35

Closed greschd closed 4 years ago

greschd commented 4 years ago

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 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:

To be reviewed especially carefully:

greschd commented 4 years ago

Yes, qe_version is optional - it will fall back on the newest version we know about.