pmutt.constants.convert_unit

pmutt.constants.convert_unit(num=None, initial=None, final=None)

Converts units between two unit sets

Parameters:
  • num (float, optional) – Number to convert. I not specified, will return the appropriate conversion factor.

  • initial (str) – Units that num is currently in

  • final (str) – Units you would like num to be in

Returns:

conversion_num – num in the appropriate units

Return type:

float

Raises:

ValueError – If unit types are not consistent or not supported

Supported Units

Energy

Unit

Description

J

Joules

kJ

KiloJoules

eV

Electron Volts

cal

Calories

kcal

Kilocalories

L atm

Liter atmospheres

Eh

Hartree

Ha

Hartree

Energy/Amount

Unit

Description

J/mol

Joules per mole

kJ/mol

KiloJoules per mole

cal/mol

Calories per mole

kcal/mol

Kilocalories per mole

eV/molecule

Electron volt per molecule

Eh/molecule

Hartree per molecule

Ha/molecule

Hartree per molecule

Time

Unit

Description

ps

Picosecond

ns

Nanosecond

ms

Millisecond

s

Seconds

min

Minutes

hr

Hours

day

Days

yr

Year

Amount

Unit

Description

molecule

Molecules

molec

Molecules

mol

Moles

Temperature

Unit

Description

C

Celcius

K

Kelvin

F

Fahrenheit

R

Rankine

Length

Unit

Description

m

Meter

cm

Centimeter

nm

Nanometer

A

Anstrom

km

Kilometer

inch

Inch

ft

Foot

mile

Mile

Area

Unit

Description

m2

Meters squared

cm2

Centimeters squared

A2

Anstroms squared

km2

Kilometers squared

inch2

Inches squared

ft2

Feet squared

Volume

Unit

Description

m3

Meter cubed

cm3

Centimeter cubed

mL

Milliliters

L

Liters

inch3

Inches cubed

ft3

Feet cubed

Mass

Unit

Description

kg

Kilograms

g

Grams

amu

Atomic mass units

lbs

Pounds

Pressure

Unit

Description

Pa

Pascals

kPa

KiloPascals

MPa

MegaPascals

atm

Atmospheres

bar

Bars

mmHg

Millilmeters of Mercury

psi

Pounds per square inch