|
| 1 | + // Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]). |
| 2 | +// https://github.com/angularsen/UnitsNet |
| 3 | +// |
| 4 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +// of this software and associated documentation files (the "Software"), to deal |
| 6 | +// in the Software without restriction, including without limitation the rights |
| 7 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | +// copies of the Software, and to permit persons to whom the Software is |
| 9 | +// furnished to do so, subject to the following conditions: |
| 10 | +// |
| 11 | +// The above copyright notice and this permission notice shall be included in |
| 12 | +// all copies or substantial portions of the Software. |
| 13 | +// |
| 14 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 20 | +// THE SOFTWARE. |
| 21 | + |
| 22 | +// ReSharper disable once CheckNamespace |
| 23 | + |
| 24 | +using UnitsNet.Units; |
| 25 | + |
| 26 | +namespace UnitsNet |
| 27 | +{ |
| 28 | + public partial struct AmountOfSubstance |
| 29 | + { |
| 30 | + /// <summary> |
| 31 | + /// The Avogadro constant is the number of constituent particles, usually molecules, |
| 32 | + /// atoms or ions that are contained in the amount of substance given by one mole. It is the proportionality factor that relates |
| 33 | + /// the molar mass of a substance to the mass of a sample, is designated with the symbol NA or L[1], and has the value |
| 34 | + /// 6.02214076e23 mol−1 in the International System of Units (SI). |
| 35 | + /// </summary> |
| 36 | + /// <remarks> |
| 37 | + /// Pending revisions in the base set of SI units necessitated redefinitions of the concepts of chemical quantity. The Avogadro number, |
| 38 | + /// and its definition, was deprecated in favor of the Avogadro constant and its definition. Based on measurements made through the |
| 39 | + /// middle of 2017 which calculated a value for the Avogadro constant of NA = 6.022140758(62)×1023 mol−1, the redefinition of SI units |
| 40 | + /// is planned to take effect on 20 May 2019. The value of the constant will be fixed to exactly 6.02214076×1023 mol−1. |
| 41 | + /// See here: https://www.bipm.org/utils/common/pdf/CGPM-2018/26th-CGPM-Resolutions.pdf |
| 42 | + /// </remarks> |
| 43 | + public static double AvogadroConstant { get; } = 6.02214076e23; |
| 44 | + |
| 45 | + /// <summary> |
| 46 | + /// Calculates the number of particles (atoms or molecules) in this amount of substance using the <see cref="AvogadroConstant"/>. |
| 47 | + /// </summary> |
| 48 | + /// <returns>The number of particles (atoms or molecules) in this amount of substance.</returns> |
| 49 | + public double NumberOfParticles() |
| 50 | + { |
| 51 | + var moles = AsBaseNumericType(AmountOfSubstanceUnit.Mole); |
| 52 | + return AvogadroConstant * moles; |
| 53 | + } |
| 54 | + } |
| 55 | +} |
0 commit comments