Skip to main content

Molecular Mass Calculations

Project description

Molmass is a Python library and console script to calculate the molecular mass (average, nominal, and isotopic pure), the elemental composition, and the mass distribution spectrum of a molecule given by its chemical formula, relative element weights, or sequence.

Calculations are based on the isotopic composition of the elements. Mass deficiency due to chemical bonding is not taken into account.

Examples of valid formulas are H2O, [2H]2O, CH3COOH, EtOH, CuSO4.5H2O, (COOH)2, AgCuRu4(H)2[CO]12{PPh3}2, CGCGAATTCGCG, and MDRGEQGLLK.

Formulas are case sensitive and + denotes the arithmetic operator, not an ion charge.

For command line usage run python -m molmass --help

Author:

Christoph Gohlke

Version:

2019.1.1

Requirements

Revisions

2019.1.1

Update copyright year.

2018.8.15

Move modules into molmass package.

2018.5.29

Add option to start web interface from console.

2018.5.25

Style and docstring fixes. Make ‘from_fractions’ output deterministic.

2005.x.x

Initial release.

Examples

>>> from molmass import Formula
>>> f = Formula('D2O')  # heavy water
>>> f.formula  # hill notation
'[2H]2O'
>>> f.empirical
'[2H]2O'
>>> f.mass  # average mass
20.027603556
>>> f.isotope.massnumber  # nominal mass
20
>>> f.isotope.mass  # monoisotopic mass
20.0231181781
>>> f.atoms
3
>>> print(f.composition())
Element  Number  Relative mass  Fraction %
2H            2       4.028204     20.1133
O             1      15.999400     79.8867
Total:        3      20.027604    100.0000
>>> print(f.spectrum())
Relative mass    Fraction %      Intensity
20.023118         99.757000     100.000000
21.027335          0.038000       0.038093
22.027364          0.205000       0.205499

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

molmass-2019.1.1.tar.gz (60.5 kB view details)

Uploaded Source

Built Distribution

molmass-2019.1.1-py2.py3-none-any.whl (63.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file molmass-2019.1.1.tar.gz.

File metadata

  • Download URL: molmass-2019.1.1.tar.gz
  • Upload date:
  • Size: 60.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for molmass-2019.1.1.tar.gz
Algorithm Hash digest
SHA256 a9b17b8abf7ebb67bff5e55bd8c2053a65626af8d3bbdfe9ef7900dc99f9cfb8
MD5 07262710f2a5c785b6cbe562374cfe24
BLAKE2b-256 2de601b576b79cef7adfeaca6d77c6991b4e6933c3d0985b9db55bf5ac223392

See more details on using hashes here.

Provenance

File details

Details for the file molmass-2019.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: molmass-2019.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 63.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for molmass-2019.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c264122565f1c2aef3fdc776c911d77ddcbe335aff33008efe438b7f8d7c2519
MD5 259188b513235a17156c29005f8bfd4a
BLAKE2b-256 21e5a4eac639c4a90ce491bc1d9e8a24779aa16741677a710a5c15dda39e8945

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page