Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding halogens kinetics (twin with DB) #2135

Merged
merged 5 commits into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arkane/explorerTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_reactions(self):
"""
test that the right number of reactions are in output network
"""
self.assertEqual(len(self.explorer_job.networks[0].path_reactions), 7)
self.assertIn(len(self.explorer_job.networks[0].path_reactions), [6,7])

def test_isomers(self):
"""
Expand Down
131 changes: 131 additions & 0 deletions examples/rmg/halogens/2-BTP/input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Example input file for 2-BTP/CF3Br in methane flames

database(
thermoLibraries = ['primaryThermoLibrary', 'DFT_QCI_thermo', 'thermo_DFT_CCSDTF12_BAC',
'halogens', 'CHOBr_G4','CHOF_G4','CHOFBr_G4', '2-BTP', '2-BTP_G4', 'Fluorine',
'CBS_QB3_1dHR','NISTThermoLibrary','JetSurF2.0'],
#reactionLibraries = ['2-BTP/seed'], #optional: use NISTs 2-BTP kinetics library as seed or reaction library
reactionLibraries = [],
seedMechanisms = ['FFCM1(-)'], #optional: use FFCM1(-) kinetics library as seed for methane combustion
kineticsDepositories = ['training'],
kineticsFamilies = ['default','halogens'], # load both the `default` and `halogens` recommended kinetics families
kineticsEstimator = 'rate rules',
)

species(
label = "2-BTP",
reactive = True,
structure = SMILES("FC(F)(F)C(Br)=C")
)

species(
label = "CF3Br",
reactive = True,
structure = SMILES("FC(F)(F)Br")
)

species(
label = 'CH4',
reactive = True,
structure = SMILES('C')
)

species(
label = "O2",
reactive = True,
structure = adjacencyList(
"""
multiplicity 3
1 O u1 p2 c0 {2,S}
2 O u1 p2 c0 {1,S}
"""
))

species(
label = "N2",
reactive = False,
structure = adjacencyList(
"""
1 N u0 p1 c0 {2,T}
2 N u0 p1 c0 {1,T}
"""
))

# reactor for 2-BTP in methane flame
simpleReactor(
temperature=[(1000,'K'),(2200,'K')],
pressure=(1.0,'bar'),
nSims=24,
initialMoleFractions={
"2-BTP": [0.0,0.04],
"CH4" : [0.05,0.15],
"O2": 0.21,
"N2": 0.78,
},
terminationConversion={
'CH4': 0.99,
},
terminationTime=(1,'s'),
)

# pressue dependence is not yet implemented for halogen chemistry
# pressureDependence(
# method='modified strong collision',
# maximumGrainSize=(0.5,'kcal/mol'),
# minimumNumberOfGrains=250,
# temperatures=(300,2200,'K',8),
# pressures=(0.01,100,'bar',5),
# interpolation=('Chebyshev', 6, 4),
# )


simulator(
atol = 1e-16,
rtol = 1e-08,
sens_atol = 1e-06,
sens_rtol = 0.0001,
)

model(
toleranceMoveToCore = 0.25,
toleranceInterruptSimulation = 1,
maximumEdgeSpecies = 5e5,
filterReactions = True,
filterThreshold = 5e8,
minCoreSizeForPrune=400,
minSpeciesExistIterationsForPrune=4,
)


# model(
# toleranceMoveToCore=1,
# toleranceInterruptSimulation=1e8,
# toleranceKeepInEdge=0.05,
# maximumEdgeSpecies=200000,
# minCoreSizeForPrune=50,
# minSpeciesExistIterationsForPrune=2,
# filterReactions = True,
# filterThreshold=5e8
# )

generatedSpeciesConstraints(
allowed=['input species','seed mechanisms','reaction libraries'],
maximumCarbonAtoms=12,
maximumOxygenAtoms=6,
# maximumHeavyAtoms=24,
maximumRadicalElectrons=2,
maximumSingletCarbenes=1,
maximumCarbeneRadicals=0,
allowSingletO2 = False,
)

options(
units = "si",
saveRestartPeriod = None,
generateOutputHTML = True,
generatePlots = False,
saveSimulationProfiles = True,
saveEdgeSpecies = False,
keepIrreversible = True,
verboseComments = False,
)
9 changes: 7 additions & 2 deletions rmgpy/data/kinetics/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,12 @@ def apply_recipe(self, reactant_structures, forward=True, unique=True, relabel_a
if atom.label != '':
atom_labels[atom.label] = atom

if label == 'h_abstraction':
if label in ('1,2_xy_interchange'):
# Labels for nodes are swapped
atom_labels['*1'].label = '*4'
atom_labels['*4'].label = '*1'

if label in ('h_abstraction','f_abstraction','cl_abstraction','br_abstraction'):
# '*2' is the H that migrates
# it moves from '*1' to '*3'
atom_labels['*1'].label = '*3'
Expand Down Expand Up @@ -2393,7 +2398,7 @@ def get_reaction_pairs(self, reaction):
for reactant in reaction.reactants:
for product in reaction.products:
pairs.append([reactant, product])
elif self.label.lower() == 'h_abstraction':
elif self.label.lower() in ('h_abstraction','f_abstraction','cl_abstraction','br_abstraction'):
# Hardcoding for hydrogen abstraction: pair the reactant containing
# *1 with the product containing *3 and vice versa
assert len(reaction.reactants) == len(reaction.products) == 2
Expand Down
11 changes: 6 additions & 5 deletions testing/databaseTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ def test_kinetics(self):
self.compat_func_name = test_name
yield test, None

test = lambda x: self.kinetics_check_groups_nonidentical(family_name)
test_name = "Kinetics family {0}: groups are not identical?".format(family_name)
test.description = test_name
self.compat_func_name = test_name
yield test, family_name
if not family.auto_generated:
test = lambda x: self.kinetics_check_groups_nonidentical(family_name)
test_name = "Kinetics family {0}: groups are not identical?".format(family_name)
test.description = test_name
self.compat_func_name = test_name
yield test, family_name

test = lambda x: self.kinetics_check_child_parent_relationships(family_name)
test_name = "Kinetics family {0}: parent-child relationships are correct?".format(family_name)
Expand Down