direction

sisl.utils.direction(d)[source]

Index coordinate corresponding to the Cartesian coordinate system.

Parameters

d ({0, "x", "a", 1, "y", "b", 2, "z", "c"}) – returns the integer that corresponds to the coordinate index (strings are lower-cased).

Returns

The index of the Cartesian coordinate system.

Return type

int

Examples

>>> direction(0)
0
>>> direction("Y")
1
>>> direction("z")
2
>>> direction("2")
2
>>> direction(" 2")
2
>>> direction("b")
1