-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patharcs_exp.py
More file actions
73 lines (64 loc) · 2.05 KB
/
Copy patharcs_exp.py
File metadata and controls
73 lines (64 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from acidwatch_api.models.base import (
BaseAdapter,
RunResult,
)
from acidwatch_api.models.datamodel import Phase
from acidwatch_api.settings import SETTINGS
DESCRIPTION: str = """Automated Reactions for CO2 Storage (ARCS) model.
ARCS combines first-principles calculations with Monte-Carlo sampling and models possible reactions that may occur under a given set of conditions.
This process identifies the most frequently occurring reactions and paths, final products, and expected concentrations.
This model is under significant development and expected to deviate while developed. Therefore a development version of it has been released while work is ongoing
Source code found at https://github.com/badw/arcs
"""
class ArcsExpAdapter(BaseAdapter):
model_id = "arcs_exp"
display_name = "ARCS experimental"
description = DESCRIPTION
category = "ChemicalEquilibrium"
valid_substances = [
"CH2O2",
"CH3CH2OH",
"CO",
"H2",
"O2",
"CH3COOH",
"CH3OH",
"CH4",
"CH3CHO",
"H2CO",
"H2O",
"H2SO4",
"H2S",
"S8",
"SO2",
"H2SO3",
"HNO3",
"NO2",
"NH3",
"HNO2",
"NO",
"N2",
"NOHSO4",
]
base_url = SETTINGS.arcs_exp_api_base_uri
async def run(self) -> RunResult:
response = await self.client.post(
f"{SETTINGS.arcs_exp_api_base_uri}/run_simulation",
json={
"concs": {
key: value / 1e6 for key, value in self.concentrations.items()
},
"temperature": self.conditions.temperature + 273,
"pressure": self.conditions.pressure,
"samples": 500,
},
timeout=300.0,
)
result = response.json()
return [
Phase(
kind="co2-rich",
fraction=1.0,
concentrations={k: v * 1e6 for k, v in result["results"].items()},
)
]