Skip to content

Commit 179c7b3

Browse files
authored
Merge branch 'main' into test_rms
2 parents d25fd24 + 6a5ebf4 commit 179c7b3

File tree

9 files changed

+539
-97
lines changed

9 files changed

+539
-97
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
id: regression-execution
170170
timeout-minutes: 60
171171
run: |
172-
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation RMS_liquidSurface_ch4o2cat fragment RMS_constantVIdealGasReactor_fragment;
172+
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation RMS_liquidSurface_ch4o2cat fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
173173
do
174174
if python rmg.py test/regression/"$regr_test"/input.py; then
175175
echo "$regr_test" "Executed Successfully"
@@ -244,7 +244,7 @@ jobs:
244244
run: |
245245
exec 2> >(tee -a regression.stderr >&2) 1> >(tee -a regression.stdout)
246246
mkdir -p "test/regression-diff"
247-
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment;
247+
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
248248
do
249249
echo ""
250250
echo "### Regression test $regr_test:"

examples/rmg/minimal_surface/input.py

Lines changed: 101 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,123 @@
11
# Data sources
22
database(
3-
thermoLibraries = ['primaryThermoLibrary'],
4-
reactionLibraries = [],
3+
thermoLibraries=['surfaceThermoPt111', 'primaryThermoLibrary', 'thermo_DFT_CCSDTF12_BAC','DFT_QCI_thermo'], # 'surfaceThermoPt' is the default. Thermo data is derived using bindingEnergies for other metals
4+
reactionLibraries = [('Surface/CPOX_Pt/Deutschmann2006_adjusted', False)], # when Ni is used change the library to Surface/Deutschmann_Ni
55
seedMechanisms = [],
66
kineticsDepositories = ['training'],
7-
kineticsFamilies = 'default',
7+
kineticsFamilies = ['surface', 'default'],
88
kineticsEstimator = 'rate rules',
99
)
10-
11-
# List of species
10+
catalystProperties(
11+
bindingEnergies = {
12+
'H': (-2.75368,'eV/molecule'),
13+
'C': (-7.02516,'eV/molecule'),
14+
'N': (-4.63225,'eV/molecule'),
15+
'O': (-3.81153,'eV/molecule'),
16+
},
17+
surfaceSiteDensity=(2.483e-9, 'mol/cm^2'),
18+
coverageDependence=False
19+
)
1220
species(
13-
label='ethane',
21+
label='CH4',
1422
reactive=True,
15-
structure=SMILES("CC"),
23+
structure=SMILES("C"),
1624
)
17-
18-
# Reaction systems
19-
simpleReactor(
20-
temperature=(1350,'K'),
21-
pressure=(1.0,'bar'),
22-
initialMoleFractions={
23-
"ethane": 1.0,
24-
},
25-
terminationConversion={
26-
'ethane': 0.9,
27-
},
28-
terminationTime=(1e6,'s'),
25+
species(
26+
label='O2',
27+
reactive=True,
28+
structure=adjacencyList(
29+
"""
30+
1 O u1 p2 c0 {2,S}
31+
2 O u1 p2 c0 {1,S}
32+
"""),
2933
)
30-
31-
simpleReactor(
32-
temperature=(1000,'K'),
33-
pressure=(1.0,'bar'),
34-
initialMoleFractions={
35-
"ethane": 1.0,
34+
species(
35+
label='N2',
36+
reactive=False,
37+
structure=SMILES("N#N"),
38+
)
39+
species(
40+
label='X',
41+
reactive=True,
42+
structure=adjacencyList("1 X u0"),
43+
)
44+
# added for training
45+
species(
46+
label='CO2X',
47+
reactive=True,
48+
structure=adjacencyList(
49+
"""
50+
1 O u0 p2 c0 {3,D}
51+
2 O u0 p2 c0 {3,D}
52+
3 C u0 p0 c0 {1,D} {2,D}
53+
4 X u0 p0 c0
54+
"""),
55+
)
56+
species(
57+
label='COX',
58+
reactive=True,
59+
structure=adjacencyList(
60+
"""
61+
1 O u0 p2 c0 {2,D}
62+
2 C u0 p0 c0 {1,D} {3,D}
63+
3 X u0 p0 c0 {2,D}
64+
"""),
65+
)
66+
species(
67+
label='OX',
68+
reactive=True,
69+
structure=adjacencyList(
70+
"""
71+
1 O u0 p2 c0 {2,D}
72+
2 X u0 p0 c0 {1,D}
73+
"""),
74+
)
75+
# If you would like to forbid the bidentate form of absorbed CO2 from your model,
76+
# use the following `CO2_bidentate` forbidden structure
77+
# forbidden(
78+
# label='CO2_bidentate',
79+
# structure=SMILES("O=C(*)O*"),
80+
# )
81+
#----------
82+
# Reaction systems
83+
surfaceReactor(
84+
temperature=(1000, 'K'),
85+
initialPressure=(1.0, 'bar'),
86+
initialGasMoleFractions={
87+
"CH4": 0.15,
88+
"O2": 0.15,
89+
"N2": 0.7,
3690
},
37-
terminationConversion={
38-
'ethane': 0.9,
91+
initialSurfaceCoverages={
92+
"X": 1.0,
3993
},
40-
terminationTime=(1e6,'s'),
94+
surfaceVolumeRatio=(1.e5, 'm^-1'),
95+
terminationConversion = { "CH4": 0.95,},
96+
terminationTime=(0.1, 's'),
97+
terminationRateRatio=0.01,
4198
)
42-
43-
44-
4599
simulator(
46-
atol=1e-16,
47-
rtol=1e-8,
100+
atol=1e-18,
101+
rtol=1e-12,
48102
)
49-
50103
model(
51104
toleranceKeepInEdge=0.0,
52-
toleranceMoveToCore=100.0,
53-
toleranceInterruptSimulation=100.0,
105+
toleranceMoveToCore=1e-1,
106+
toleranceInterruptSimulation=0.1,
54107
maximumEdgeSpecies=100000,
55-
toleranceMoveEdgeReactionToSurface=1.0,
56-
toleranceMoveSurfaceReactionToCore=2.0,
57-
toleranceMoveSurfaceSpeciesToCore=.001,
58-
dynamicsTimeScale=(1.0e-10,'sec'),
59108
)
60-
61109
options(
62110
units='si',
63-
generateOutputHTML=True,
64-
generatePlots=False,
65-
saveEdgeSpecies=True,
66-
saveSimulationProfiles=True,
111+
generateOutputHTML=False,
112+
generatePlots=False, # Enable to make plots of core and edge size etc. But takes a lot of the total runtime!
113+
saveEdgeSpecies=False,
114+
saveSimulationProfiles=False,
115+
)
116+
generatedSpeciesConstraints(
117+
allowed=['input species','reaction libraries'],
118+
maximumCarbonAtoms=2,
119+
maximumOxygenAtoms=2,
120+
maximumSurfaceSites=2,
67121
)
122+
123+

rmgpy/thermo/model.pyx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,18 @@ cdef class HeatCapacityModel(RMGObject):
163163

164164
Tdata = [300,400,500,600,800,1000,1500,2000]
165165
for T in Tdata:
166-
if not (0.8 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.25):
166+
# Do exact comparison in addition to relative in case both are zero (surface site)
167+
if self.get_heat_capacity(T) != other.get_heat_capacity(T) and \
168+
not (0.8 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.25):
167169
return False
168-
elif not (0.8 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.25):
170+
elif self.get_enthalpy(T) != other.get_enthalpy(T) and \
171+
not (0.8 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.25):
169172
return False
170-
elif not (0.8 < self.get_entropy(T) / other.get_entropy(T) < 1.25):
173+
elif self.get_entropy(T) != other.get_entropy(T) and \
174+
not (0.8 < self.get_entropy(T) / other.get_entropy(T) < 1.25):
171175
return False
172-
elif not (0.8 < self.get_free_energy(T) / other.get_free_energy(T) < 1.25):
176+
elif self.get_free_energy(T) != other.get_free_energy(T) and \
177+
not (0.8 < self.get_free_energy(T) / other.get_free_energy(T) < 1.25):
173178
return False
174179

175180
return True
@@ -185,13 +190,18 @@ cdef class HeatCapacityModel(RMGObject):
185190

186191
Tdata = [300,400,500,600,800,1000,1500,2000]
187192
for T in Tdata:
188-
if not (0.95 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.05):
193+
# Do exact comparison in addition to relative in case both are zero (surface site)
194+
if self.get_heat_capacity(T) != other.get_heat_capacity(T) and \
195+
not (0.95 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.05):
189196
return False
190-
elif not (0.95 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.05):
197+
elif self.get_enthalpy(T) != other.get_enthalpy(T) and \
198+
not (0.95 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.05):
191199
return False
192-
elif not (0.95 < self.get_entropy(T) / other.get_entropy(T) < 1.05):
200+
elif self.get_entropy(T) != other.get_entropy(T) and \
201+
not (0.95 < self.get_entropy(T) / other.get_entropy(T) < 1.05):
193202
return False
194-
elif not (0.95 < self.get_free_energy(T) / other.get_free_energy(T) < 1.05):
203+
elif self.get_free_energy(T) != other.get_free_energy(T) and \
204+
not (0.95 < self.get_free_energy(T) / other.get_free_energy(T) < 1.05):
195205
return False
196206

197207
return True

0 commit comments

Comments
 (0)