https://github.com/xrsrke/exex
Experiment codebase for chemchem package
https://github.com/xrsrke/exex
chemistry chemistry-solver general-chemistry python
Last synced: 7 months ago
JSON representation
Experiment codebase for chemchem package
- Host: GitHub
- URL: https://github.com/xrsrke/exex
- Owner: xrsrke
- License: mit
- Created: 2022-09-30T05:07:20.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-11T03:13:54.000Z (almost 3 years ago)
- Last Synced: 2025-01-21T15:26:28.683Z (9 months ago)
- Topics: chemistry, chemistry-solver, general-chemistry, python
- Language: Jupyter Notebook
- Homepage: https://xrsrke.github.io/exex
- Size: 1.56 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
exex
================This file will become your README and also the index of your
documentation.## Install
``` sh
pip install exex
`````` python
C2 = Gas('C2')
`````` python
O2 = Gas('O2')
`````` python
CO2 = Gas('CO2')
`````` python
r = Reaction(reactants=[Gas('C2'), Gas('O2')], products=[Gas('CO2')])
`````` python
r.__dict__
```{'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': ,
'environment': }``` python
CO2.get_system()
```
``` python
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}``` python
r
```exex.reaction.core.Reaction(formula='1C₂ + 1O₂ --> 1C₁O₂')
``` python
CO2.properties
```{'mass': ,
'mole': ,
'pressure': ,
'volume': ,
'temperature': ,
'ideal_gas_constant': ,
'is_ideal_gas': }``` python
CO2.laws['mass_mole_ratio'].__dict__
```{'compound': exex.gas.core.Gas(formula='C₁O₂'),
'properties': [{'object': exex.core.Mass}, {'object': exex.core.Mole}]}``` python
from exex.utils import camel_to_snake
`````` python
camel2snake(CO2.__class__.__name__)
```'gas'
``` python
C2.snake_name
```'C2'
``` python
reactants = [C2, O2]
`````` python
dic = {}
`````` python
C2.formula
```'C₂'
``` python
for reactant in reactants:
dic[reactant.snake_name] = reactant
`````` python
dic
```{'C2': exex.gas.core.Gas(formula='C₂'), 'O2': exex.gas.core.Gas(formula='O₂')}
``` python
C2
```exex.gas.core.Gas(formula='C₂')
``` python
C2.__dict__
```{'properties': {'mass': ,
'mole': ,
'pressure': ,
'volume': ,
'temperature': ,
'ideal_gas_constant': ,
'is_ideal_gas': },
'laws': {'mass_mole_ratio': ,
'boyle_law': ,
'charles_law': ,
'avogadro_law': ,
'ideal_gas_law': },
'time': None,
'system': ,
'elements': [,
],
'formula': 'C₂',
'coefficient': 1,
'occurences': {'C': 2}}``` python
C2.formula
```'C₂'
``` python
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}``` python
from chemlib import Reaction, Compound
`````` python
Reaction(reactants=[Compound('CO2')], products=[]).__dict__
```{'reactants': [],
'products': [],
'compounds': [],
'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}