Copyright | Michael Thomas |
---|---|
License | GPL-3 |
Maintainer | Michael Thomas <Michaelt293@gmail.com> |
Stability | Experimental |
Safe Haskell | None |
Language | Haskell2010 |
- Type synonyms for masses
- Other type synonyms
Isotope
andElement
data types- Element symbols
- Functions taking an
Element
as input elements
- a map containing isotopic data for each element.- Functions taking an
elementSymbol
as input ChemicalMass
type class- Elemental composition
- Molecular formulae
- Condensed formulae
- Empirical formulae
- QuasiQuoter
Import this module to work with the Isotope library. Isotope provides a range of data types, functions and class abstractions for working with elements and molecules. The main focus of Isotope is the calculation of element/molecular masses. For more information regarding Isotope, please refer to the README.
- type IntegerMass = MassNumber
- type MonoisotopicMass = Double
- type NominalMass = Int
- type AverageMass = Double
- type IsotopicMass = Double
- type ElementName = String
- type IsotopicAbundance = Double
- type AtomicNumber = Int
- type ProtonNumber = AtomicNumber
- type NeutronNumber = Int
- type Nucleons = (ProtonNumber, NeutronNumber)
- type MassNumber = Int
- data Isotope = Isotope {}
- data Element = Element {}
- data ElementSymbol
- = H
- | He
- | Li
- | Be
- | B
- | C
- | N
- | O
- | F
- | Ne
- | Na
- | Mg
- | Al
- | Si
- | P
- | S
- | Cl
- | Ar
- | K
- | Ca
- | Sc
- | Ti
- | V
- | Cr
- | Mn
- | Fe
- | Co
- | Ni
- | Cu
- | Zn
- | Ga
- | Ge
- | As
- | Se
- | Br
- | Kr
- | Rb
- | Sr
- | Y
- | Zr
- | Nb
- | Mo
- | Ru
- | Rh
- | Pd
- | Ag
- | Cd
- | In
- | Sn
- | Sb
- | Te
- | I
- | Xe
- | Cs
- | Ba
- | La
- | Ce
- | Pr
- | Nd
- | Sm
- | Eu
- | Gd
- | Tb
- | Dy
- | Ho
- | Er
- | Tm
- | Yb
- | Lu
- | Hf
- | Ta
- | W
- | Re
- | Os
- | Ir
- | Pt
- | Au
- | Hg
- | Tl
- | Pb
- | Bi
- | Th
- | Pa
- | U
- elementSymbolList :: [ElementSymbol]
- elementMostAbundantIsotope :: Element -> Isotope
- elementIsotopicMasses :: Element -> [IsotopicMass]
- elementIntegerMasses :: Element -> [IntegerMass]
- elementIsotopicAbundances :: Element -> [IsotopicAbundance]
- elementMonoisotopicMass :: Element -> IsotopicMass
- elementNominalMass :: Element -> MassNumber
- elementAverageMass :: Element -> IsotopicMass
- massNumber :: Nucleons -> MassNumber
- elements :: Map ElementSymbol Element
- lookupElement :: ElementSymbol -> Maybe Element
- findElement :: ElementSymbol -> Element
- elementName :: ElementSymbol -> ElementName
- atomicNumber :: ElementSymbol -> AtomicNumber
- isotopes :: ElementSymbol -> [Isotope]
- mostAbundantIsotope :: ElementSymbol -> Isotope
- selectIsotope :: ElementSymbol -> MassNumber -> Isotope
- isotopicMasses :: ElementSymbol -> [IsotopicMass]
- integerMasses :: ElementSymbol -> [IntegerMass]
- isotopicAbundances :: ElementSymbol -> [IsotopicAbundance]
- class ChemicalMass a where
- newtype ElementalComposition = ElementalComposition {}
- newtype MolecularFormula = MolecularFormula {}
- (|+|) :: MolecularFormula -> MolecularFormula -> MolecularFormula
- (|-|) :: MolecularFormula -> MolecularFormula -> MolecularFormula
- (|*|) :: Int -> MolecularFormula -> MolecularFormula
- mkMolecularFormula :: [(ElementSymbol, Int)] -> MolecularFormula
- class Formula a where
- class ChemicalMass a => ToMolecularFormula a where
- newtype CondensedFormula = CondensedFormula {}
- newtype EmpiricalFormula = EmpiricalFormula {}
- class ChemicalMass a => ToEmpiricalFormula a where
- mkEmpiricalFormula :: [(ElementSymbol, Int)] -> EmpiricalFormula
- mol :: QuasiQuoter
- emp :: QuasiQuoter
- con :: QuasiQuoter
Type synonyms for masses
type IntegerMass = MassNumber Source #
Integer mass for an isotope.
type MonoisotopicMass = Double Source #
The exact mass of the most abundant isotope for an element or the sum of the exact masses of the most abundant isotope of each element for a molecular formula.
type NominalMass = Int Source #
The integer mass of the most abundant isotope for an element or the sum of integer mass of the most abundant isotope of each element for a chemical formula.
type AverageMass = Double Source #
The average mass of an element or molecular formula based on naturally-occurring abundances.
type IsotopicMass = Double Source #
The exact mass of an isotope.
Other type synonyms
type ElementName = String Source #
The name of an element.
type IsotopicAbundance = Double Source #
The natural abundance of an isotope.
type AtomicNumber = Int Source #
Atomic number of an element.
type ProtonNumber = AtomicNumber Source #
Proton number (i.e., the number of protons) for an element/isotope.
type NeutronNumber = Int Source #
Neutron number (i.e., the number of neutrons) for an element.
type Nucleons = (ProtonNumber, NeutronNumber) Source #
Type synonym for a pair containing ProtonNumber
and NeutronNumber
.
type MassNumber = Int Source #
The number of protons plus the number of neutrons (i.e., proton number + neutron number) for an isotope.
Isotope
and Element
data types
An Isotope
has three parameters; Nucleons
, IsotopeMass
and
IsotopicAbundance
.
An Element
has three parameters; AtomicNumber
, ElementName
and
list of Isotope
.
Element symbols
data ElementSymbol Source #
Element symbols as an enumeration type.
elementSymbolList :: [ElementSymbol] Source #
List containing all element symbols.
Functions taking an Element
as input
elementMostAbundantIsotope :: Element -> Isotope Source #
Returns the most abundant naturally-occurring isotope for an element.
elementIsotopicMasses :: Element -> [IsotopicMass] Source #
Exact masses for all naturally-occurring isotopes for an element.
elementIntegerMasses :: Element -> [IntegerMass] Source #
Integer masses for all naturally-occurring isotopes for an element.
elementIsotopicAbundances :: Element -> [IsotopicAbundance] Source #
Isotope abundances for all naturally-occurring isotopes for an element.
elementMonoisotopicMass :: Element -> IsotopicMass Source #
Monoistopic mass for an element.
elementNominalMass :: Element -> MassNumber Source #
Nominal mass for an element.
elementAverageMass :: Element -> IsotopicMass Source #
Average mass of an element.
massNumber :: Nucleons -> MassNumber Source #
elements
- a map containing isotopic data for each element.
elements :: Map ElementSymbol Element Source #
Map of the periodic table. All data on isotopic masses and abundances is contained within this map.
Functions taking an elementSymbol
as input
lookupElement :: ElementSymbol -> Maybe Element Source #
Searches elements (a map) with an ElementSymbol
key and returns
information for the element (wrapped in Maybe
).
findElement :: ElementSymbol -> Element Source #
Searches elements
(a map) with an ElementSymbol
key and returns
information for the element.
elementName :: ElementSymbol -> ElementName Source #
Returns the name for an element symbol.
atomicNumber :: ElementSymbol -> AtomicNumber Source #
Returns the atomic number for an element.
isotopes :: ElementSymbol -> [Isotope] Source #
Returns all the naturally-occurring isotopes for an element.
mostAbundantIsotope :: ElementSymbol -> Isotope Source #
Returns the most abundant naturally-occurring isotope for an element.
selectIsotope :: ElementSymbol -> MassNumber -> Isotope Source #
Selects an isotope of element based on the isotope's mass number
(IntegerMass
). Note: This is a partial function.
isotopicMasses :: ElementSymbol -> [IsotopicMass] Source #
Exact masses for all naturally-occurring isotopes for an element.
integerMasses :: ElementSymbol -> [IntegerMass] Source #
Integer masses for all naturally-occurring isotopes for an element.
isotopicAbundances :: ElementSymbol -> [IsotopicAbundance] Source #
Isotope abundances for all naturally-occurring isotopes for an element.
ChemicalMass
type class
class ChemicalMass a where Source #
Class containing four methods; toElementalComposition
,
monoisotopicMass
, nominalMass
and averageMass
.
toElementalComposition :: a -> ElementalComposition Source #
monoisotopicMass :: a -> MonoisotopicMass Source #
nominalMass :: a -> NominalMass Source #
averageMass :: a -> AverageMass Source #
Elemental composition
newtype ElementalComposition Source #
Provided since EmpiricalFormula
can be thought of as a chemical
composition but is not a molecular formula.
Molecular formulae
newtype MolecularFormula Source #
MolecularFormula
is a newtype to represent a molecular formula.
(|+|) :: MolecularFormula -> MolecularFormula -> MolecularFormula infixl 6 Source #
Infix operator for the addition of molecular formulae. (|+|) is mappend in the monoid instance and the same fixity as (+).
(|-|) :: MolecularFormula -> MolecularFormula -> MolecularFormula infixl 6 Source #
Infix operator for the subtraction of molecular formulae. Has the same fixity as (-).
(|*|) :: Int -> MolecularFormula -> MolecularFormula infixl 7 Source #
Infix operator for the multiplication of molecular formulae. Has the same fixity as (*).
mkMolecularFormula :: [(ElementSymbol, Int)] -> MolecularFormula Source #
Smart constructor to make values of type MolecularFormula
.
class Formula a where Source #
Type class with two methods, renderFormula
and emptyFormula
. The
renderFormula
method converts a formula to its shorthand notation.
renderFormula :: a -> String Source #
emptyFormula :: a Source #
class ChemicalMass a => ToMolecularFormula a where Source #
toMolecularFormula :: a -> MolecularFormula Source #
Condensed formulae
newtype CondensedFormula Source #
CondensedFormula
is a newtype to represent a condensed formula.
Empirical formulae
newtype EmpiricalFormula Source #
EmpiricalFormula
is a newtype to represent a empirical formula.
class ChemicalMass a => ToEmpiricalFormula a where Source #
Type class with a single method, toEmpiricalFormula
, which converts a
chemical data type to EmpiricalFormula
.
toEmpiricalFormula :: a -> EmpiricalFormula Source #
mkEmpiricalFormula :: [(ElementSymbol, Int)] -> EmpiricalFormula Source #
Smart constructor to make values of type EmpiricalFormula
.
QuasiQuoter
mol :: QuasiQuoter Source #
emp :: QuasiQuoter Source #
con :: QuasiQuoter Source #