sisl.units package

Module contents

Units from various programs

This conversion tool is inspired by the SIESTA fdf-parser in its group-construct.

sisl.units.unit_group(unit, tbl=None)[source]

Returns the unit group that is associated with input unit.

Parameters:

unit : str

unit, e.g. kg, Ang, eV etc. returns the type of unit it is.

Examples

>>> unit_group('kg')
'mass'
>>> unit_group('eV')
'energy'
sisl.units.unit_convert(fr, to, opts={}, tbl=None)[source]

Returns the factor that takes ‘fr’ to the units of ‘to’.

Parameters:

fr :

starting unit

to :

ending unit

opts :

controls whether the unit conversion is in powers or fractional units

Examples

——-

>>> unit_convert(‘kg’,’g’)

1000

>>> unit_convert(‘eV’,’J’)

1.60219e-19

sisl.units.unit_default(group, tbl=None)[source]

Return the default unit in the group group.

Parameters:

group, str

look-up in the table for the default unit.