### ----------------------------------------------------
### -- Physics::Unit
### -- Licenses: Artistic-2.0
### -- Authors: librasteve
### -- File: bin/default_en.txt
### ----------------------------------------------------
### -- Chunk 2 of 2
 Gaussian system of units ===
@group Gaussian
    franklin = erg ** 0.5 * centimeter ** 0.5 = Fr = statcoulomb = statC = esu
    statvolt = erg / franklin = statV
    statampere = franklin / second = statA
    gauss = dyne / franklin = G
    maxwell = gauss * centimeter ** 2 = Mx
    oersted = dyne / maxwell = Oe = ørsted
    statohm = statvolt / statampere = statΩ
    statfarad = franklin / statvolt = statF
    statmho = statampere / statvolt
@end
# Note this system is not commensurate with SI, as ε_0 and µ_0 disappear;
# some quantities with different dimensions in SI have the same
# dimensions in the Gaussian system (e.g. [Mx] = [Fr], but [Wb] != [C]),
# and therefore the conversion factors depend on the context (not in pint sense)
[gaussian_charge] = [length] ** 1.5 * [mass] ** 0.5 / [time]
[gaussian_current] = [gaussian_charge] / [time]
[gaussian_electric_potential] = [gaussian_charge] / [length]
[gaussian_electric_field] = [gaussian_electric_potential] / [length]
[gaussian_electric_displacement_field] = [gaussian_charge] / [area]
[gaussian_electric_flux] = [gaussian_charge]
[gaussian_electric_dipole] = [gaussian_charge] * [length]
[gaussian_electric_quadrupole] = [gaussian_charge] * [area]
[gaussian_magnetic_field] = [force] / [gaussian_charge]
[gaussian_magnetic_field_strength] = [gaussian_magnetic_field]
[gaussian_magnetic_flux] = [gaussian_magnetic_field] * [area]
[gaussian_magnetic_dipole] = [energy] / [gaussian_magnetic_field]
[gaussian_resistance] = [gaussian_electric_potential] / [gaussian_current]
[gaussian_resistivity] = [gaussian_resistance] * [length]
[gaussian_capacitance] = [gaussian_charge] / [gaussian_electric_potential]
[gaussian_inductance] = [gaussian_electric_potential] * [time] / [gaussian_current]
[gaussian_conductance] = [gaussian_current] / [gaussian_electric_potential]
@context Gaussian = Gau
    [gaussian_charge] -> [charge]: value / k_C ** 0.5
    [charge] -> [gaussian_charge]: value * k_C ** 0.5
    [gaussian_current] -> [current]: value / k_C ** 0.5
    [current] -> [gaussian_current]: value * k_C ** 0.5
    [gaussian_electric_potential] -> [electric_potential]: value * k_C ** 0.5
    [electric_potential] -> [gaussian_electric_potential]: value / k_C ** 0.5
    [gaussian_electric_field] -> [electric_field]: value * k_C ** 0.5
    [electric_field] -> [gaussian_electric_field]: value / k_C ** 0.5
    [gaussian_electric_displacement_field] -> [electric_displacement_field]: value / (4 * π / ε_0) ** 0.5
    [electric_displacement_field] -> [gaussian_electric_displacement_field]: value * (4 * π / ε_0) ** 0.5
    [gaussian_electric_dipole] -> [electric_dipole]: value / k_C ** 0.5
    [electric_dipole] -> [gaussian_electric_dipole]: value * k_C ** 0.5
    [gaussian_electric_quadrupole] -> [electric_quadrupole]: value / k_C ** 0.5
    [electric_quadrupole] -> [gaussian_electric_quadrupole]: value * k_C ** 0.5
    [gaussian_magnetic_field] -> [magnetic_field]: value / (4 * π / µ_0) ** 0.5
    [magnetic_field] -> [gaussian_magnetic_field]: value * (4 * π / µ_0) ** 0.5
    [gaussian_magnetic_flux] -> [magnetic_flux]: value / (4 * π / µ_0) ** 0.5
    [magnetic_flux] -> [gaussian_magnetic_flux]: value * (4 * π / µ_0) ** 0.5
    [gaussian_magnetic_field_strength] -> [magnetic_field_strength]: value / (4 * π * µ_0) ** 0.5
    [magnetic_field_strength] -> [gaussian_magnetic_field_strength]: value * (4 * π * µ_0) ** 0.5
    [gaussian_magnetic_dipole] -> [magnetic_dipole]: value * (4 * π / µ_0) ** 0.5
    [magnetic_dipole] -> [gaussian_magnetic_dipole]: value / (4 * π / µ_0) ** 0.5
    [gaussian_resistance] -> [resistance]: value * k_C
    [resistance] -> [gaussian_resistance]: value / k_C
    [gaussian_resistivity] -> [resistivity]: value * k_C
    [resistivity] -> [gaussian_resistivity]: value / k_C
    [gaussian_capacitance] -> [capacitance]: value / k_C
    [capacitance] -> [gaussian_capacitance]: value * k_C
    [gaussian_inductance] -> [inductance]: value * k_C
    [inductance] -> [gaussian_inductance]: value / k_C
    [gaussian_conductance] -> [conductance]: value / k_C
    [conductance] -> [gaussian_conductance]: value * k_C
@end

# === ESU system of units ===
#   (where different from Gaussian)
#   See note for Gaussian system too
@group ESU using Gaussian
    statweber = statvolt * second = statWb
    stattesla = statweber / centimeter ** 2 = statT
    stathenry = statweber / statampere = statH
@end
[esu_charge] = [length] ** 1.5 * [mass] ** 0.5 / [time]
[esu_current] = [esu_charge] / [time]
[esu_electric_potential] = [esu_charge] / [length]
[esu_magnetic_flux] = [esu_electric_potential] * [time]
[esu_magnetic_field] = [esu_magnetic_flux] / [area]
[esu_magnetic_field_strength] = [esu_current] / [length]
[esu_magnetic_dipole] = [esu_current] * [area]
@context ESU = esu
    [esu_magnetic_field] -> [magnetic_field]: value * k_C ** 0.5
    [magnetic_field] -> [esu_magnetic_field]: value / k_C ** 0.5
    [esu_magnetic_flux] -> [magnetic_flux]: value * k_C ** 0.5
    [magnetic_flux] -> [esu_magnetic_flux]: value / k_C ** 0.5
    [esu_magnetic_field_strength] -> [magnetic_field_strength]: value / (4 * π / ε_0) ** 0.5
    [magnetic_field_strength] -> [esu_magnetic_field_strength]: value * (4 * π / ε_0) ** 0.5
    [esu_magnetic_dipole] -> [magnetic_dipole]: value / k_C ** 0.5
    [magnetic_dipole] -> [esu_magnetic_dipole]: value * k_C ** 0.5
@end


#### CONVERSION CONTEXTS ####

@context(n=1) spectroscopy = sp
    # n index of refraction of the medium.
    [length] <-> [frequency]: speed_of_light / n / value
    [frequency] -> [energy]: planck_constant * value
    [energy] -> [frequency]: value / planck_constant
    # allow wavenumber / kayser
    [wavenumber] <-> [length]: 1 / value
@end

@context boltzmann
    [temperature] -> [energy]: boltzmann_constant * value
    [energy] -> [temperature]: value / boltzmann_constant
@end

@context energy
    [energy] -> [energy] / [substance]: value * N_A
    [energy] / [substance] -> [energy]: value / N_A
    [energy] -> [mass]: value / c ** 2
    [mass] -> [energy]: value * c ** 2
@end

@context(mw=0,volume=0,solvent_mass=0) chemistry = chem
    # mw is the molecular weight of the species
    # volume is the volume of the solution
    # solvent_mass is the mass of solvent in the solution

    # moles -> mass require the molecular weight
    [substance] -> [mass]: value * mw
    [mass] -> [substance]: value / mw

    # moles/volume -> mass/volume and moles/mass -> mass/mass
    # require the  molecular weight
    [substance] / [volume] -> [mass] / [volume]: value * mw
    [mass] / [volume] -> [substance] / [volume]: value / mw
    [substance] / [mass] -> [mass] / [mass]: value * mw
    [mass] / [mass] -> [substance] / [mass]: value / mw

    # moles/volume -> moles requires the solution volume
    [substance] / [volume] -> [substance]: value * volume
    [substance] -> [substance] / [volume]: value / volume

    # moles/mass -> moles requires the solvent (usually water) mass
    [substance] / [mass] -> [substance]: value * solvent_mass
    [substance] -> [substance] / [mass]: value / solvent_mass

    # moles/mass -> moles/volume require the solvent mass and the volume
    [substance] / [mass] -> [substance]/[volume]: value * solvent_mass / volume
    [substance] / [volume] -> [substance] / [mass]: value / solvent_mass * volume

@end

@context textile
    # Allow switching between Direct count system (i.e. tex) and
    # Indirect count system (i.e. Ne, Nm)
    [mass] / [length] <-> [length] / [mass]: 1 / value
@end


#### SYSTEMS OF UNITS ####

@system SI
    second
    meter
    kilogram
    ampere
    kelvin
    mole
    candela
@end

@system mks using international
    meter
    kilogram
    second
@end

@system cgs using international, Gaussian, ESU
    centimeter
    gram
    second
@end

@system atomic using international
    # based on unit m_e, e, hbar, k_C, k
    bohr: meter
    electron_mass: gram
    atomic_unit_of_time: second
    atomic_unit_of_current: ampere
    atomic_unit_of_temperature: kelvin
@end

@system Planck using international
    # based on unit c, gravitational_constant, hbar, k_C, k
    planck_length: meter
    planck_mass: gram
    planck_time: second
    planck_current: ampere
    planck_temperature: kelvin
@end

@system imperial using ImperialVolume, USCSLengthInternational, AvoirdupoisUK
    yard
    pound
@end

@system US using USCSLiquidVolume, USCSDryVolume, USCSVolumeOther, USCSLengthInternational, USCSLengthSurvey, AvoirdupoisUS
    yard
    pound
@end


