Skip to content

Commit e848daa

Browse files
authored
Merge pull request #2824 from ReactionMechanismGenerator/fix/examples
Fix broken examples
2 parents 9ec6975 + db8868e commit e848daa

15 files changed

Lines changed: 49 additions & 31 deletions

File tree

examples/rmg/MR_test/input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@
275275
minimumNumberOfGrains=250,
276276
#the conditions for the rate to be output over
277277
#parameter order is: low_value, high_value, units, internal points
278-
temperatures=(300,2200,'K',2),
279-
pressures=(0.01,100.01,'bar',3),
278+
temperatures=(300,2200,'K',10),
279+
pressures=(0.01,100.01,'bar',10),
280280
#The two options for interpolation are 'PDepArrhenius' (no extra arguments) and
281281
#'Chebyshev' which is followed by the number of basis sets in
282282
#Temperature and Pressure. These values must be less than the number of

examples/rmg/TEOS/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
reactionLibraries = [],
55
seedMechanisms = [],
66
kineticsDepositories = ['training'],
7-
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
7+
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O', '!surface'],
88
kineticsEstimator = 'rate rules',
99
)
1010

examples/rmg/catalysis/methane_steam/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Data sources
22
database(
33
thermoLibraries=['surfaceThermoNi111', 'surfaceThermoPt111', 'primaryThermoLibrary', 'thermo_DFT_CCSDTF12_BAC'],
4-
reactionLibraries = [('Surface/Deutschmann_Ni', True)], # when Pt is used change the library to Surface/CPOX_Pt/Deutschmann2006
4+
reactionLibraries = [('Surface/Methane/Deutschmann_Ni', True)], # when Pt is used change the library to Surface/CPOX_Pt/Deutschmann2006
55
seedMechanisms = [],
66
kineticsDepositories = ['training'],
77
kineticsFamilies = ['surface','default'],

examples/rmg/commented/input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@
250250
minimumNumberOfGrains=250,
251251
# the conditions for the rate to be output over
252252
# parameter order is: low_value, high_value, units, internal points
253-
temperatures=(300, 2200, 'K', 2),
254-
pressures=(0.01, 100, 'bar', 3),
253+
temperatures=(300, 2200, 'K', 10),
254+
pressures=(0.01, 100, 'bar', 10),
255255
# The two options for interpolation are 'PDepArrhenius' (no extra arguments) and
256256
# 'Chebyshev' which is followed by the number of basis sets in
257257
# Temperature and Pressure. These values must be less than the number of

examples/rmg/e85/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
reactionLibraries = [],
55
seedMechanisms = ['GRI-Mech3.0'],
66
kineticsDepositories = ['training'],
7-
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
7+
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O', '!surface'],
88
kineticsEstimator = 'rate rules',
99
)
1010

examples/rmg/gri_mech_rxn_lib/input.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
maximumEdgeSpecies=100000
4141
)
4242

43+
generatedSpeciesConstraints(
44+
maximumCarbeneRadicals=2,
45+
)
46+
4347
options(
4448
units='si',
4549
generateOutputHTML=False,

examples/rmg/methylformate/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
reactionLibraries = [('Methylformate',False),('Glarborg/highP',False)],
55
seedMechanisms = ['Glarborg/C2'],
66
kineticsDepositories = ['training'],
7-
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
7+
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O', '!surface'],
88
kineticsEstimator = 'rate rules',
99
)
1010

examples/rmg/minimal_sensitivity/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
reactionLibraries = [],
55
seedMechanisms = [],
66
kineticsDepositories = ['training'],
7-
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O'],
7+
kineticsFamilies = ['!Intra_Disproportionation','!Substitution_O', '!surface'],
88
kineticsEstimator = 'rate rules',
99
)
1010

examples/rmg/nox_transitory_edge/input.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
reactive=True,
1313
structure=SMILES("CC"),
1414
)
15+
1516
species(
1617
label='O2',
1718
structure=SMILES("[O][O]"),
1819
)
20+
1921
species(
2022
label='N2',
2123
reactive=False,
@@ -76,6 +78,7 @@
7678

7779
generatedSpeciesConstraints(
7880
allowed=['input species','seed mechanisms','reaction libraries'],
81+
allowSingletO2=True,
7982
#maximumCarbonAtoms=5,
8083
#maximumOxygenAtoms=8,
8184
#maximumNitrogenAtoms=0,

rmgpy/constraints.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def pass_cutting_threshold(species):
6161
def fails_species_constraints(species):
6262
"""
6363
Pass in either a `Species` or `Molecule` object and checks whether it passes
64-
the speciesConstraints set by the user. If not, returns `True` for failing speciesConstraints.
64+
the speciesConstraints set by the user. If the species fails constraints, returns
65+
a string `reason` describing which constraint failed. If all constraints pass, returns `False`.
6566
"""
6667

6768
from rmgpy.rmg.input import get_input
@@ -86,57 +87,58 @@ def fails_species_constraints(species):
8687
max_carbon_atoms = species_constraints.get('maximumCarbonAtoms', -1)
8788
if max_carbon_atoms != -1:
8889
if struct.get_num_atoms('C') > max_carbon_atoms:
89-
return True
90+
return f"Exceeded maximumCarbonAtoms: {struct.get_num_atoms('C')} > {max_carbon_atoms}"
9091

9192
max_oxygen_atoms = species_constraints.get('maximumOxygenAtoms', -1)
9293
if max_oxygen_atoms != -1:
9394
if struct.get_num_atoms('O') > max_oxygen_atoms:
94-
return True
95+
return f"Exceeded maximumOxygenAtoms: {struct.get_num_atoms('O')} > {max_oxygen_atoms}"
9596

9697
max_nitrogen_atoms = species_constraints.get('maximumNitrogenAtoms', -1)
9798
if max_nitrogen_atoms != -1:
9899
if struct.get_num_atoms('N') > max_nitrogen_atoms:
99-
return True
100+
return f"Exceeded maximumNitrogenAtoms: {struct.get_num_atoms('N')} > {max_nitrogen_atoms}"
100101

101102
max_silicon_atoms = species_constraints.get('maximumSiliconAtoms', -1)
102103
if max_silicon_atoms != -1:
103104
if struct.get_num_atoms('Si') > max_silicon_atoms:
104-
return True
105+
return f"Exceeded maximumSiliconAtoms: {struct.get_num_atoms('Si')} > {max_silicon_atoms}"
105106

106107
max_sulfur_atoms = species_constraints.get('maximumSulfurAtoms', -1)
107108
if max_sulfur_atoms != -1:
108109
if struct.get_num_atoms('S') > max_sulfur_atoms:
109-
return True
110+
return f"Exceeded maximumSulfurAtoms: {struct.get_num_atoms('S')} > {max_sulfur_atoms}"
110111

111112
max_heavy_atoms = species_constraints.get('maximumHeavyAtoms', -1)
112113
if max_heavy_atoms != -1:
113-
if struct.get_num_atoms() - struct.get_num_atoms('H') > max_heavy_atoms:
114-
return True
114+
heavy_atoms = struct.get_num_atoms() - struct.get_num_atoms('H')
115+
if heavy_atoms > max_heavy_atoms:
116+
return f"Exceeded maximumHeavyAtoms: {heavy_atoms} > {max_heavy_atoms}"
115117

116118
max_surface_sites = species_constraints.get('maximumSurfaceSites', -1)
117119
if max_surface_sites != -1:
118120
if struct.get_num_atoms('X') > max_surface_sites:
119-
return True
121+
return f"Exceeded maximumSurfaceSites: {struct.get_num_atoms('X')} > {max_surface_sites}"
120122

121123
max_surface_bond_order = species_constraints.get('maximumSurfaceBondOrder', -1)
122124
if max_surface_bond_order != -1:
123125
for site in struct.get_surface_sites():
124126
if site.get_total_bond_order() > max_surface_bond_order:
125-
return True
127+
return f"Exceeded maximumSurfaceBondOrder at site: {site.get_total_bond_order()} > {max_surface_bond_order}"
126128

127129
max_radicals = species_constraints.get('maximumRadicalElectrons', -1)
128130
if max_radicals != -1:
129131
if struct.get_radical_count() > max_radicals:
130-
return True
132+
return f"Exceeded maximumRadicalElectrons: {struct.get_radical_count()} > {max_radicals}"
131133

132134
max_carbenes = species_constraints.get('maximumSingletCarbenes', 1)
133-
if max_radicals != -1:
135+
if max_carbenes != -1:
134136
if struct.get_singlet_carbene_count() > max_carbenes:
135-
return True
137+
return f"Exceeded maximumSingletCarbenes: {struct.get_singlet_carbene_count()} > {max_carbenes}"
136138

137139
max_carbene_radicals = species_constraints.get('maximumCarbeneRadicals', 0)
138140
if max_carbene_radicals != -1:
139141
if struct.get_singlet_carbene_count() > 0 and struct.get_radical_count() > max_carbene_radicals:
140-
return True
142+
return f"Exceeded maximumCarbeneRadicals: {struct.get_radical_count()} > {max_carbene_radicals}"
141143

142144
return False

0 commit comments

Comments
 (0)