-
Notifications
You must be signed in to change notification settings - Fork 400
Add AmountOfSubstance.AvogadroConstant #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cb33286
d90a58c
1c3d954
Merge branch 'master' into Avogadro
tmilnthorp a428c75
ff6c9fb
Rename to twoMoles
angularsen d72abbe
Add xmldoc
angularsen 9463a05
Add closing summary tag in xmldoc
angularsen 1188dfb
Merge branch 'master' into Avogadro
tmilnthorp a9ce56d
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). | ||
// https://github.com/angularsen/UnitsNet | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
// ReSharper disable once CheckNamespace | ||
|
||
using UnitsNet.Units; | ||
|
||
namespace UnitsNet | ||
{ | ||
public partial struct AmountOfSubstance | ||
{ | ||
/// <summary> | ||
/// The Avogadro constant is the number of constituent particles, usually molecules, | ||
/// atoms or ions that are contained in the amount of substance given by one mole. It is the proportionality factor that relates | ||
/// 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 | ||
/// 6.02214076e23 mol−1 in the International System of Units (SI). | ||
/// </summary> | ||
/// <remarks> | ||
/// Pending revisions in the base set of SI units necessitated redefinitions of the concepts of chemical quantity. The Avogadro number, | ||
/// and its definition, was deprecated in favor of the Avogadro constant and its definition. Based on measurements made through the | ||
/// middle of 2017 which calculated a value for the Avogadro constant of NA = 6.022140758(62)×1023 mol−1, the redefinition of SI units | ||
/// is planned to take effect on 20 May 2019. The value of the constant will be fixed to exactly 6.02214076×1023 mol−1. | ||
/// See here: https://www.bipm.org/utils/common/pdf/CGPM-2018/26th-CGPM-Resolutions.pdf | ||
/// </remarks> | ||
public static double AvogadroConstant { get; } = 6.02214076e23; | ||
tmilnthorp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// <summary> | ||
/// Calculates the number of particles (atoms or molecules) in this amount of substance using the <see cref="AvogadroConstant"/>. | ||
/// </summary> | ||
/// <returns>The number of particles (atoms or molecules) in this amount of substance.</returns> | ||
public double NumberOfParticles() | ||
{ | ||
var moles = AsBaseNumericType(AmountOfSubstanceUnit.Mole); | ||
return AvogadroConstant * moles; | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.