Utility functions for checking compatibility of structures with supercell
When doing phase boundary tracking, one needs to work with a supercell that can accommodate the phases on the boundaries. Generally, this means that the supercell may have to be larger than any of the two cells. To facilitate the creation of such supercells, we should implement a utility function that takes two or more structures and returns the smallest possible supercell compatible with both.
Use case
A suggested use case:
atoms1 = AuCu(...)
atoms2 = AuCu3(...)
atoms3 = bulk(...).repeat(2, 2, 1)
supercell = get_smallest_common_supercell(atoms1, atoms2, atoms3)
I suggest that the function (the name of which should be improved) takes any number of arguments, i.e. get_smallest_common_supercell(*structures)
. Also, I suggest that the symmetry of the given atoms are not taken into account, i.e. they are already reduced to their smallest cell. Alternatively, that reduction could be asked for with a keyword.
\boldsymbol{h}_1 \boldsymbol{P}_1 = \boldsymbol{h}_2 \boldsymbol{P}_2
where \boldsymbol{P}_i\in\Z
subject to the condition that \det{\boldsymbol{P}_i}
is as small as possible.
Demo
-
Function implemented -
Function unit tested -
Function demonstrated with an example -
Tests pass
History
@rmagnus 6/12: Added a proper description and proposed use case