This file will become your README and also the index of your documentation.
pip install exex
C2 = Gas('C2')
O2 = Gas('O2')
CO2 = Gas('CO2')
r = Reaction(reactants=[Gas('C2'), Gas('O2')], products=[Gas('CO2')])
r.__dict__
{'reaction': <chemlib.chemistry.Reaction>,
'reactants': [exex.gas.core.Gas(formula='C₂'),
exex.gas.core.Gas(formula='O₂')],
'products': [exex.gas.core.Gas(formula='C₁O₂')],
'formula': '1C₂ + 1O₂ --> 1C₁O₂',
'system': <exex.system.System>,
'environment': <exex.environment.OpenContainer>}
CO2.get_system()
<exex.system.System>
r.system.__dict__
{'universe': None,
'current_time': None,
'highest_time': None,
'reactions': [exex.reaction.core.Reaction(formula='1C₂ + 1O₂ --> 1C₁O₂')],
'_subscribers': {},
'idx_reaction': None}
r
exex.reaction.core.Reaction(formula='1C₂ + 1O₂ --> 1C₁O₂')
CO2.properties
{'mass': <exex.core.Mass>,
'mole': <exex.core.Mole>,
'pressure': <exex.core.Pressure>,
'volume': <exex.core.Volume>,
'temperature': <exex.core.Temperature>,
'ideal_gas_constant': <exex.gas.core.IdealGasConstant>,
'is_ideal_gas': <exex.gas.core.IsIdealGas>}
CO2.laws['mass_mole_ratio'].__dict__
{'compound': exex.gas.core.Gas(formula='C₁O₂'),
'properties': [{'object': exex.core.Mass}, {'object': exex.core.Mole}]}
from exex.utils import camel_to_snake
camel2snake(CO2.__class__.__name__)
'gas'
C2.snake_name
'C2'
reactants = [C2, O2]
dic = {}
C2.formula
'C₂'
for reactant in reactants:
dic[reactant.snake_name] = reactant
dic
{'C2': exex.gas.core.Gas(formula='C₂'), 'O2': exex.gas.core.Gas(formula='O₂')}
C2
exex.gas.core.Gas(formula='C₂')
C2.__dict__
{'properties': {'mass': <exex.core.Mass>,
'mole': <exex.core.Mole>,
'pressure': <exex.core.Pressure>,
'volume': <exex.core.Volume>,
'temperature': <exex.core.Temperature>,
'ideal_gas_constant': <exex.gas.core.IdealGasConstant>,
'is_ideal_gas': <exex.gas.core.IsIdealGas>},
'laws': {'mass_mole_ratio': <exex.compound.core.MassMoleRatio>,
'boyle_law': <exex.gas.core.BoyleLaw>,
'charles_law': <exex.gas.core.CharlesLaw>,
'avogadro_law': <exex.gas.core.AvogadroLaw>,
'ideal_gas_law': <exex.gas.core.IdealGasLaw>},
'time': None,
'system': <exex.system.System>,
'elements': [<chemlib.chemistry.Element>,
<chemlib.chemistry.Element>],
'formula': 'C₂',
'coefficient': 1,
'occurences': {'C': 2}}
C2.formula
'C₂'
r.reaction.__dict__
{'reactants': [exex.gas.core.Gas(formula='C₂'),
exex.gas.core.Gas(formula='O₂')],
'products': [exex.gas.core.Gas(formula='C₁O₂')],
'compounds': [exex.gas.core.Gas(formula='C₂'),
exex.gas.core.Gas(formula='O₂'),
exex.gas.core.Gas(formula='C₁O₂')],
'reactant_formulas': ['C₂', 'O₂'],
'product_formulas': ['C₁O₂'],
'formula': '1C₂ + 1O₂ --> 1C₁O₂',
'coefficients': {'C₂': 1, 'O₂': 1, 'C₁O₂': 1},
'constituents': ['C₂', 'O₂', 'C₁O₂'],
'reactant_occurences': {'C': 2, 'O': 2},
'product_occurences': {'C': 1, 'O': 2},
'is_balanced': False}
from chemlib import Reaction, Compound
Reaction(reactants=[Compound('CO2')], products=[]).__dict__
{'reactants': [<chemlib.chemistry.Compound>],
'products': [],
'compounds': [<chemlib.chemistry.Compound>],
'reactant_formulas': ['C₁O₂'],
'product_formulas': [],
'formula': '1C₁O₂ --> ',
'coefficients': {'C₁O₂': 1},
'constituents': ['C₁O₂'],
'reactant_occurences': {'C': 1, 'O': 2},
'product_occurences': {},
'is_balanced': False}