elements

package
Version: v0.0.0-...-8b1917f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	Symbol  string    // Symbol, e.g. "Na"
	Name    string    // Full name, e.g. sodium
	Number  int       // Atomic number e.g. 11
	Isotope []Isotope // Isotope masses and abundances, e.g. {22.989770,1}
}

Element contains mass spec related information about an chemical element

type Elems

type Elems struct {
	Elements  []Element
	SymbolMap map[string]int
}

Elems wraps the contents of all elements

func New

func New() *Elems

New parses the build-in list of elements

func Read

func Read(r io.Reader) (*Elems, error)

Read reads elements in JSON format from an io.Reader

func (*Elems) ElemIdx

func (e *Elems) ElemIdx(shortName string) (int, error)

ElemIdx converts an element string to an index

func (*Elems) Isotopes

func (e *Elems) Isotopes(i int) ([]Isotope, error)

Isotopes returns the isotopes of a specific element

func (*Elems) Name

func (e *Elems) Name(i int) (string, error)

Name returns the element name for a given element index

func (*Elems) Symbol

func (e *Elems) Symbol(i int) (string, error)

Symbol returns the element symbol for a given element index

type Isotope

type Isotope struct {
	Mass      float64 // Mass in Daltons
	Abundance float64 // Abundance (fraction)
}

Isotope contains mass and abundance of a single isotope

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL