Skip to content

Commit

Permalink
Merge branch 'main' into test_rms
Browse files Browse the repository at this point in the history
  • Loading branch information
hwpang authored May 14, 2024
2 parents d25fd24 + 6a5ebf4 commit 179c7b3
Show file tree
Hide file tree
Showing 9 changed files with 539 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
id: regression-execution
timeout-minutes: 60
run: |
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;
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;
do
if python rmg.py test/regression/"$regr_test"/input.py; then
echo "$regr_test" "Executed Successfully"
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
run: |
exec 2> >(tee -a regression.stderr >&2) 1> >(tee -a regression.stdout)
mkdir -p "test/regression-diff"
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment;
for regr_test in aromatics liquid_oxidation nitrogen oxidation sulfur superminimal RMS_constantVIdealGasReactor_superminimal RMS_CSTR_liquid_oxidation fragment RMS_constantVIdealGasReactor_fragment minimal_surface;
do
echo ""
echo "### Regression test $regr_test:"
Expand Down
146 changes: 101 additions & 45 deletions examples/rmg/minimal_surface/input.py
Original file line number Diff line number Diff line change
@@ -1,67 +1,123 @@
# Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
thermoLibraries=['surfaceThermoPt111', 'primaryThermoLibrary', 'thermo_DFT_CCSDTF12_BAC','DFT_QCI_thermo'], # 'surfaceThermoPt' is the default. Thermo data is derived using bindingEnergies for other metals
reactionLibraries = [('Surface/CPOX_Pt/Deutschmann2006_adjusted', False)], # when Ni is used change the library to Surface/Deutschmann_Ni
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsFamilies = ['surface', 'default'],
kineticsEstimator = 'rate rules',
)

# List of species
catalystProperties(
bindingEnergies = {
'H': (-2.75368,'eV/molecule'),
'C': (-7.02516,'eV/molecule'),
'N': (-4.63225,'eV/molecule'),
'O': (-3.81153,'eV/molecule'),
},
surfaceSiteDensity=(2.483e-9, 'mol/cm^2'),
coverageDependence=False
)
species(
label='ethane',
label='CH4',
reactive=True,
structure=SMILES("CC"),
structure=SMILES("C"),
)

# Reaction systems
simpleReactor(
temperature=(1350,'K'),
pressure=(1.0,'bar'),
initialMoleFractions={
"ethane": 1.0,
},
terminationConversion={
'ethane': 0.9,
},
terminationTime=(1e6,'s'),
species(
label='O2',
reactive=True,
structure=adjacencyList(
"""
1 O u1 p2 c0 {2,S}
2 O u1 p2 c0 {1,S}
"""),
)

simpleReactor(
temperature=(1000,'K'),
pressure=(1.0,'bar'),
initialMoleFractions={
"ethane": 1.0,
species(
label='N2',
reactive=False,
structure=SMILES("N#N"),
)
species(
label='X',
reactive=True,
structure=adjacencyList("1 X u0"),
)
# added for training
species(
label='CO2X',
reactive=True,
structure=adjacencyList(
"""
1 O u0 p2 c0 {3,D}
2 O u0 p2 c0 {3,D}
3 C u0 p0 c0 {1,D} {2,D}
4 X u0 p0 c0
"""),
)
species(
label='COX',
reactive=True,
structure=adjacencyList(
"""
1 O u0 p2 c0 {2,D}
2 C u0 p0 c0 {1,D} {3,D}
3 X u0 p0 c0 {2,D}
"""),
)
species(
label='OX',
reactive=True,
structure=adjacencyList(
"""
1 O u0 p2 c0 {2,D}
2 X u0 p0 c0 {1,D}
"""),
)
# If you would like to forbid the bidentate form of absorbed CO2 from your model,
# use the following `CO2_bidentate` forbidden structure
# forbidden(
# label='CO2_bidentate',
# structure=SMILES("O=C(*)O*"),
# )
#----------
# Reaction systems
surfaceReactor(
temperature=(1000, 'K'),
initialPressure=(1.0, 'bar'),
initialGasMoleFractions={
"CH4": 0.15,
"O2": 0.15,
"N2": 0.7,
},
terminationConversion={
'ethane': 0.9,
initialSurfaceCoverages={
"X": 1.0,
},
terminationTime=(1e6,'s'),
surfaceVolumeRatio=(1.e5, 'm^-1'),
terminationConversion = { "CH4": 0.95,},
terminationTime=(0.1, 's'),
terminationRateRatio=0.01,
)



simulator(
atol=1e-16,
rtol=1e-8,
atol=1e-18,
rtol=1e-12,
)

model(
toleranceKeepInEdge=0.0,
toleranceMoveToCore=100.0,
toleranceInterruptSimulation=100.0,
toleranceMoveToCore=1e-1,
toleranceInterruptSimulation=0.1,
maximumEdgeSpecies=100000,
toleranceMoveEdgeReactionToSurface=1.0,
toleranceMoveSurfaceReactionToCore=2.0,
toleranceMoveSurfaceSpeciesToCore=.001,
dynamicsTimeScale=(1.0e-10,'sec'),
)

options(
units='si',
generateOutputHTML=True,
generatePlots=False,
saveEdgeSpecies=True,
saveSimulationProfiles=True,
generateOutputHTML=False,
generatePlots=False, # Enable to make plots of core and edge size etc. But takes a lot of the total runtime!
saveEdgeSpecies=False,
saveSimulationProfiles=False,
)
generatedSpeciesConstraints(
allowed=['input species','reaction libraries'],
maximumCarbonAtoms=2,
maximumOxygenAtoms=2,
maximumSurfaceSites=2,
)


26 changes: 18 additions & 8 deletions rmgpy/thermo/model.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,18 @@ cdef class HeatCapacityModel(RMGObject):

Tdata = [300,400,500,600,800,1000,1500,2000]
for T in Tdata:
if not (0.8 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.25):
# Do exact comparison in addition to relative in case both are zero (surface site)
if self.get_heat_capacity(T) != other.get_heat_capacity(T) and \
not (0.8 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.25):
return False
elif not (0.8 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.25):
elif self.get_enthalpy(T) != other.get_enthalpy(T) and \
not (0.8 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.25):
return False
elif not (0.8 < self.get_entropy(T) / other.get_entropy(T) < 1.25):
elif self.get_entropy(T) != other.get_entropy(T) and \
not (0.8 < self.get_entropy(T) / other.get_entropy(T) < 1.25):
return False
elif not (0.8 < self.get_free_energy(T) / other.get_free_energy(T) < 1.25):
elif self.get_free_energy(T) != other.get_free_energy(T) and \
not (0.8 < self.get_free_energy(T) / other.get_free_energy(T) < 1.25):
return False

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

Tdata = [300,400,500,600,800,1000,1500,2000]
for T in Tdata:
if not (0.95 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.05):
# Do exact comparison in addition to relative in case both are zero (surface site)
if self.get_heat_capacity(T) != other.get_heat_capacity(T) and \
not (0.95 < self.get_heat_capacity(T) / other.get_heat_capacity(T) < 1.05):
return False
elif not (0.95 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.05):
elif self.get_enthalpy(T) != other.get_enthalpy(T) and \
not (0.95 < self.get_enthalpy(T) / other.get_enthalpy(T) < 1.05):
return False
elif not (0.95 < self.get_entropy(T) / other.get_entropy(T) < 1.05):
elif self.get_entropy(T) != other.get_entropy(T) and \
not (0.95 < self.get_entropy(T) / other.get_entropy(T) < 1.05):
return False
elif not (0.95 < self.get_free_energy(T) / other.get_free_energy(T) < 1.05):
elif self.get_free_energy(T) != other.get_free_energy(T) and \
not (0.95 < self.get_free_energy(T) / other.get_free_energy(T) < 1.05):
return False

return True
Expand Down
Loading

0 comments on commit 179c7b3

Please sign in to comment.