pwtools.pwscf.ibrav2cell

pwtools.pwscf.ibrav2cell(ibrav, celldm)[source]

Convert PWscf’s ibrav + celldm to cell. All formulas are taken straight from the PWscf homepage. Don’t blame me for errors. Use after testing.

This function generates primitive cells. Note that in crys.py (and anywhere else in the package, for that matter) we do not have a distinction between conventional/primitive cell. We always think in primitive cells. Especially celldm in crys.py can be converted to/from cell and cryst_const. But here, celldm is the PWscf style celldm, which describes the conventional cell. For example, for an fcc cell (ibrav=2), celldm[0] == a == alat is the lattice constant “a” of the cubic conventional cell (cell=a*identity(3)), which is also found in a .cif file together with all symmetries. OTOH, for a hexagonal cell (ibrav=4) primitive == conventional cell.

celldm (a = celldm[0]) is assumed be in the unit that you want for cell (Bohr, Angstrom, etc).

Note: There are some documentation <-> forluma errors / inconsistencies for ibrav=12,13. See test/test_ibrav.py. If you really need that, have a look at the PWscf source for how they do it there.

Parameters:
  • ibrav (int) – 1 … 14

  • celldm (sequence of length 6) – This not the isame length 6 array celldm in crys.py. Here, the entries which are not needed can be None.

Returns:

array (3,3)

Return type:

cell vectors as rows, unit is that of celldm[0], i.e. a

Notes

  • ibrav = 14 is actually the only case where all 6 entries of celldm are needed and therefore the same as crys.cc2cell(crys.celldm2cc(celldm)). The returned cell here has the same spatial orientation as the one returned from crys.cc2cell(): a along x, b in xy-plane.