Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
documentation:language_reference:constants:energy_units [2016/10/10 09:41] – external edit 127.0.0.1 | documentation:language_reference:constants:energy_units [2017/08/02 15:26] (current) – Maurits W. Haverkort | ||
---|---|---|---|
Line 2: | Line 2: | ||
### | ### | ||
- | alligned paragraph text | + | The unit for energy used varies wildly between field. Even within one field there is often more then one unit used. Quanty allows to use any unit one likes and makes it easy to transform between units of energy. The variable // |
### | ### | ||
- | ===== Example | + | ### |
+ | Besides the option to change between Joule, electron Volt, Rydberg or many other obscure units one can express the unit for temperature and magnetic field to the unit of energy. This allows for clean scripting without the need of Bolzman' | ||
+ | ### | ||
+ | |||
+ | ===== Basics | ||
### | ### | ||
- | description | + | Conversion between units is implemented in the constant EnergyUnits. For example the Rydberg energy in units of electron volts can be found in the constant: |
+ | <code Quanty Example.Quanty> | ||
+ | print(EnergyUnits.Ryd.value) | ||
+ | </ | ||
+ | which returns: | ||
+ | <file Quanty_Output> | ||
+ | 13.605693009454 | ||
+ | </ | ||
+ | The unit of this number is obtained from: | ||
+ | <code Quanty Example.Quanty> | ||
+ | print(EnergyUnits.Ryd.units) | ||
+ | </ | ||
+ | which returns: | ||
+ | <file Quanty_Output> | ||
+ | eV | ||
+ | </ | ||
+ | A definition of the Rydberg can be found in the description: | ||
+ | <code Quanty Example.Quanty> | ||
+ | print(EnergyUnits.Ryd.description) | ||
+ | </ | ||
+ | which returns: | ||
+ | <file Quanty_Output> | ||
+ | Rydberg, binding energy of a clasical electron to a point potential of 1 unit of electrical charge in units of electron Volt | ||
+ | </ | ||
### | ### | ||
- | ==== Input ==== | + | ===== All units implemented |
+ | |||
+ | ### | ||
+ | A list of all implemented energy units can be obtained by printing all elements in the global table EnergyUnits: | ||
<code Quanty Example.Quanty> | <code Quanty Example.Quanty> | ||
- | -- some example code | + | for constant, |
+ | io.write(string.format(" | ||
+ | io.write(string.format(" | ||
+ | io.write(string.format(" | ||
+ | end | ||
</ | </ | ||
+ | which returns: | ||
+ | <file Quanty_Output> | ||
+ | Energy transferred (or work done) to an object when a force of one newton acts on that object in the direction of its motion through a distance of one meter in units of electron Volt | ||
+ | EnergyUnits.perfs | ||
+ | | ||
+ | 10^15 h in units of electron Volt | ||
+ | EnergyUnits.Hartree | ||
+ | | ||
+ | | ||
+ | EnergyUnits.Tesla | ||
+ | | ||
+ | muB Bohr magneton in units of electron Volt | ||
+ | EnergyUnits.Kelvin | ||
+ | | ||
+ | kB Boltzmann constant in units of electron Volt | ||
+ | EnergyUnits.eV | ||
+ | | ||
+ | The amount of energy gained (or lost) by the charge of a single electron moved across an electric potential difference of one volt in units of electron Volt | ||
+ | EnergyUnits.T | ||
+ | | ||
+ | muB Bohr magneton in units of electron Volt | ||
+ | EnergyUnits.TeraHz | ||
+ | | ||
+ | 10^12 h in units of electron Volt | ||
+ | EnergyUnits.pernm | ||
+ | | ||
+ | 10^9 h c in units of electron Volt | ||
+ | EnergyUnits.fs^-1 | ||
+ | | ||
+ | 10^15 h in units of electron Volt | ||
+ | EnergyUnits.THz | ||
+ | | ||
+ | 10^12 h in units of electron Volt | ||
+ | EnergyUnits.Rydberg | ||
+ | | ||
+ | | ||
+ | EnergyUnits.K | ||
+ | | ||
+ | kB Boltzmann constant in units of electron Volt | ||
+ | EnergyUnits.J | ||
+ | | ||
+ | | ||
+ | EnergyUnits.cm^-1 | ||
+ | | ||
+ | 100 h c in units of electron Volt | ||
+ | EnergyUnits.percm | ||
+ | | ||
+ | 100 h c in units of electron Volt | ||
+ | EnergyUnits.nm^-1 | ||
+ | | ||
+ | 10^9 h c in units of electron Volt | ||
+ | EnergyUnits.electron Volt | ||
+ | | ||
+ | The amount of energy gained (or lost) by the charge of a single electron moved across an electric potential difference of one volt in units of electron Volt | ||
+ | EnergyUnits.Ryd | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | ### | ||
- | ==== Result | + | ===== Change of unit used for the values |
- | <WRAP center box 100> | + | |
- | text produced as output | + | ### |
- | </WRAP> | + | Without further settings the unit of all energy units in electron volt (eV). This is not a must and can be changed. By setting the variable EnergyUnits.Set one can change the standard unit. If one wants to have Joules as the unit of energy one can do: |
+ | <code Quanty Example.Quanty> | ||
+ | EnergyUnits.Set=" | ||
+ | |||
+ | for constant, | ||
+ | io.write(string.format(" | ||
+ | io.write(string.format(" | ||
+ | io.write(string.format(" | ||
+ | end | ||
+ | </ | ||
+ | which sets the energy unit to Joule. The script furthermore returns all energy units implemented, | ||
+ | <file Quanty_Output> | ||
+ | EnergyUnits.nm^-1 | ||
+ | | ||
+ | 10^9 h c in units of Joule | ||
+ | EnergyUnits.T | ||
+ | | ||
+ | muB Bohr magneton in units of Joule | ||
+ | EnergyUnits.eV | ||
+ | | ||
+ | The amount of energy gained (or lost) by the charge of a single electron moved across an electric potential difference of one volt in units of Joule | ||
+ | EnergyUnits.cm^-1 | ||
+ | | ||
+ | 100 h c in units of Joule | ||
+ | EnergyUnits.pernm | ||
+ | | ||
+ | 10^9 h c in units of Joule | ||
+ | EnergyUnits.Ryd | ||
+ | | ||
+ | | ||
+ | EnergyUnits.K | ||
+ | | ||
+ | kB Boltzmann constant in units of Joule | ||
+ | EnergyUnits.THz | ||
+ | | ||
+ | 10^12 h in units of Joule | ||
+ | EnergyUnits.Tesla | ||
+ | | ||
+ | muB Bohr magneton in units of Joule | ||
+ | EnergyUnits.J | ||
+ | | ||
+ | | ||
+ | EnergyUnits.fs^-1 | ||
+ | | ||
+ | 10^15 h in units of Joule | ||
+ | EnergyUnits.electron Volt | ||
+ | | ||
+ | The amount of energy gained (or lost) by the charge of a single electron moved across an electric potential difference of one volt in units of Joule | ||
+ | EnergyUnits.Hartree | ||
+ | | ||
+ | | ||
+ | EnergyUnits.percm | ||
+ | | ||
+ | 100 h c in units of Joule | ||
+ | EnergyUnits.TeraHz | ||
+ | | ||
+ | 10^12 h in units of Joule | ||
+ | EnergyUnits.Rydberg | ||
+ | | ||
+ | | ||
+ | EnergyUnits.Joule | ||
+ | | ||
+ | | ||
+ | EnergyUnits.perfs | ||
+ | | ||
+ | 10^15 h in units of Joule | ||
+ | EnergyUnits.Kelvin | ||
+ | | ||
+ | kB Boltzmann constant in units of Joule | ||
+ | EnergyUnits.Ha | ||
+ | | ||
+ | | ||
+ | </file> | ||
+ | ### | ||
+ | |||
+ | ===== Conversion table ===== | ||
+ | |||
+ | |||
+ | ### | ||
+ | A table converting all units into each other can be obtained by printing the table EnergyUnits | ||
+ | <code Quanty Example.Quanty> | ||
+ | print(EnergyUnits) | ||
+ | </code> | ||
+ | which returns | ||
+ | <file Quanty_Output> | ||
+ | Conversion table between energy units | ||
+ | Joule | ||
+ | J | ||
+ | J | ||
+ | Ryd | ||
+ | Ha 4.35974464991E-18 2.00000000000E+00 1.00000000000E+00 2.72113860189E+01 3.15775129351E+05 4.70103509995E+05 2.19474631367E-02 2.19474631367E+05 6.57968392062E+03 6.57968392062E+00 | ||
+ | eV 1.60217662080E-19 7.34986449647E-02 3.67493224823E-02 1.00000000000E+00 1.16045220604E+04 1.72759854889E+04 8.06554400480E-04 8.06554400480E+03 2.41798926230E+02 2.41798926230E-01 | ||
+ | K | ||
+ | T | ||
+ | nm^-1 1.98644582417E-16 9.11267050567E+01 4.55633525283E+01 1.23984197396E+03 1.43877735383E+07 2.14194919507E+07 1.00000000000E+00 1.00000000000E+07 2.99792458000E+05 2.99792458000E+02 | ||
+ | cm^-1 1.98644582417E-23 9.11267050567E-06 4.55633525283E-06 1.23984197396E-04 1.43877735383E+00 2.14194919507E+00 1.00000000000E-07 1.00000000000E+00 2.99792458000E-02 2.99792458000E-05 | ||
+ | THz | ||
+ | fs^-1 6.62607004000E-19 3.03965969206E-01 1.51982984603E-01 4.13566766234E+00 4.79924466221E+04 7.14477345214E+04 3.33564095198E-03 3.33564095198E+04 1.00000000000E+03 1.00000000000E+00 | ||
+ | </ | ||
+ | ### | ||
===== Sub pages ===== | ===== Sub pages ===== | ||
{{indexmenu> | {{indexmenu> | ||
- |