How to use the pythoms.classes.Molecule function in pythoms

To help you get started, we’ve selected a few pythoms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github larsyunker / PythoMS / nmols calculator.py View on Github external
'''how much?'''
amount = 30

'''what is the unit?'''
unit = [
    # 'g',
    # 'mg',
    # 'ug',
    # 'mol',
    # 'mmol',
    'umol',
]

from pythoms.classes import Molecule

mol = Molecule(formula,
               dropmethod='threshold',
               )

if len(unit) > 1:
    raise ValueError('only one unit may be specified')
if unit[0].startswith('m'):  # milli
    if unit[0][1] != 'o':
        order = 3
    else:  # if 'mol'
        order = 0
elif unit[0].startswith('u'):  # micro
    order = 6
else:  # standard
    order = 0

amount = float(amount)  # make sure it's a float
github larsyunker / PythoMS / Polycondensation calculator.py View on Github external
kwargs = {
    'dropmethod': 'threshold'
}

Ar = 'Ar+'
X = 'I'
arunit = 'C6H4'
cap = 'Ph'

n = 6

print(Ar)
print('aromatic units')
print('n\tmass')
for i in range(1, n):
    print('%d\t%.2f' % (i, Molecule(Ar + (arunit * i) + X, **kwargs).em))

print('\nPd units')
print('n\tmass')
for i in range(1, n):
    print('%d\t%.2f' % (i, Molecule('L2Pd' + Ar + (arunit * i) + X, **kwargs).em))

print('\ncapped')
print('n\tmass')
for i in range(0, n + 3):
    print('%d\t%.2f' % (i, Molecule(cap + Ar + (arunit * i), **kwargs).em))