Useful functions to work with basic chemistry and stochiemetry
Project description
The Chemyst library
To install chemyst run pip install chemyst
Usage For P_total
# gas_laws stands for Pressure, Volume, Number of Moles, R is the ideal gas law constant, T is temperature
from chemyst.gas_laws import P_total
# Mixture of 3 gases lets say
total_pressure = P_total([9.987, 2.33, 123.9])
print(total_pressure)
# OUTPUT: 136.217
Args:
- pressure is the only argument to P_total
- It is a list of the partial pressure of all the gases in a mixture
Usage For partial_pressure
from chemyst.gas_laws import partial_pressure
# Args: num_moles, ideal_gas_law, temp, volume, is_temp_kelvin=True
pressureO2 = partial_pressure(2, 'atm', 31, 15.0, False)
print(pressureO2)
# OUTPUT: 13.2
Args:
- num_of_moles is the number of moles of the given gas
- ideal_gas_law is the ideal gas law constant to use for the given pressure unit
- if the pressure unit is atm
- ideal_gas_law should be 'atm'
- if the pressure unit is kpa
- ideal_gas_law should be 'kpa'
- if the pressure unit is mmHg
- ideal_gas_law should be 'mmhg'
- if the pressure unit is atm
- temp is the given temperature can be either Celsius or Kelvin
- volume is the volume of the container
- is_temp_kelvin determines whether the temperature should be converter to Kelvin or not
- if the temperature is in celsius is_temp_kelvin should equal false
Usage For the conversions module
from chemyst.conversions import moles_to_mass, mass_to_moles, atoms_to_grams, grams_to_atoms, ml_to_l, l_to_ml
# Moles to mass OUTPUT: 512g
moles_to_mass(16, 32)
# Mass to moles OUTPUT: 16.0
mass_to_moles(512, 32)
# Atoms to grams OUTPUT: 7.18e20
atoms_to_grams(1352, 32)
# Grams to atoms OUTPUT: 1.88e24
grams_to_atoms(100, 32)
# Mililiters to liters OUTPUT: 1 liter
ml_to_l(1000)
# Liters to mililiters OUTPUT: 1000ml
l_to_ml(1)
Args:
- moles_to_mass(num_moles, molar_mass)
- num_moles is the number of moles to be converted to grams
- molar_mass is the mass of the element in grams
- for example O2 would have a molar mass of 32
- mass_to_moles(g_of_element, molar_mass)
- g_of_element is the amount of grams which will be converted to moles
- molar_mass is the mass of the element in grams
- atoms_to_grams(num_atoms, molar_mass)
- num_atoms is the number of atoms to be converted to grams
- molar_mass is the mass of the element in grams
- grams_to_atoms(g_of_element, molar_mass)
- g_of_element is the amount of grams which will be converted to moles
- molar_mass is the mass of the element in grams
- ml_to_l(ml)
- ml is the number of mililiters to convert into liters
- l_to_ml(l)
- l is the number of liters to convert into mililiters
Usage for the molar module
Molar and finding the moles
The molar module gives the Molar amount (M) from the moles and volume of a solution
from chemyst.molar import molar, find_moles
# Find the Molar amount of 3 moles of sugar in 5 liters of water
molar(3, 5) # OUTPUT: 0.6M
# Find the number of moles of sugar with the Volume and Moles of the same siolution
find_moles(0.6, 5) # OUTPUT: 3 Moles Sugar
Usage For the yields module
Theoretical yield
The yields module is slightly different than the others
the theoretical_yield() function takes 3 arguments:
- actual_yield
- the yield given in the equation
- mole_ratio_top which is
- From the balanced equation given, the number of moles of the wanted element
- mole_ratio_bottom which likewise is
- From the balanced equation given, the number of moles of the given element
IMPORTANT: the theoretical_yield() function arguments MUST all be moles
this can be easily achieved by using the moles_to_mass
and mass_to_moles
functions of chemyst.conversions
Percent Yield
the percent yield() function take 2 arguments
- actual_yield
- yield given in the equation
- theoretical_yield
- this yield can be calculated using the theoretical_yield() function
IMPORTANT: the percent_yield() function arguments MUST all be grams
this can be easily achieved by using the moles_to_mass
and mass_to_moles
functions of chemyst.conversions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file chemyst-2.3.0.tar.gz
.
File metadata
- Download URL: chemyst-2.3.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 984fcddc3492920a7aa00ab76ae76453bdcf588a85ea5c63a1a64ef2431e6925 |
|
MD5 | ee2be8a499feab71de7c0662c7537bdc |
|
BLAKE2b-256 | 27d5a0f0c46ac6e56ddb38a62e949fe916a4c89755c2591776c7840649225b47 |
File details
Details for the file chemyst-2.3.0-py3-none-any.whl
.
File metadata
- Download URL: chemyst-2.3.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b45954336a4126ff7fbd1a8515bf9bdd7dd7535a04cea4d476c5f88999bfd19b |
|
MD5 | 7899b271216370a8e62b54e6a0ce5832 |
|
BLAKE2b-256 | 450e8541c4f15e6fb54a58d3e0eaf36aea329c624a13884e04b4184ec9a27f37 |