Skip to content

Commit c20f0fc

Browse files
committed
add comment parsing tests for autogenerated tree
1 parent ae61efd commit c20f0fc

File tree

3 files changed

+140
-0
lines changed

3 files changed

+140
-0
lines changed

test/rmgpy/data/kinetics/kineticsTest.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,49 @@ def test_parse_kinetics(self):
800800
assert "PDep" in sources[6]
801801
assert sources[6]["PDep"] == 7
802802

803+
# ------------------------------------------------------------------- #
804+
# Source 7 comes from a node on an autogenerated tree
805+
assert "Rate Rules" in sources[7]
806+
family_label = sources[7]["Rate Rules"][0]
807+
training_rxn = sources[7]["Rate Rules"][1]
808+
809+
assert family_label == "Disproportionation"
810+
811+
template_str = sources[7]["Rate Rules"][1]["template"][0].label
812+
assert template_str == "Root_Ext-2R!H-R_2R!H->C_4R->C"
813+
814+
reconstructed_kinetics = self.database.kinetics.reconstruct_kinetics_from_source(reactions[7], sources[7], fix_barrier_height=True)
815+
A = reconstructed_kinetics.A.value_si
816+
n = reconstructed_kinetics.n.value_si
817+
assert round(abs(reactions[7].kinetics.A.value_si - A), 7) == 0
818+
assert round(abs(reactions[7].kinetics.n.value_si - n), 7) == 0
819+
820+
# ------------------------------------------------------------------- #
821+
# Source 8 comes from a node on an autogenerated tree, but it's been broken up by the chemkin writer
822+
assert "Rate Rules" in sources[8]
823+
assert sources[8]["Rate Rules"][0] == "Disproportionation"
824+
825+
template_str = sources[8]["Rate Rules"][1]["template"][0].label
826+
assert template_str == "Root_Ext-1R!H-R_N-4R->O_N-Sp-5R!H=1R!H_Ext-4CHNS-R_N-6R!H->S_4CHNS->C_N-Sp-6BrBrBrCCCClClClFFFIIINNNOOOPPPSiSiSi#4C_6BrCClFINOPSi->C_N-1R!H-inRing_N-Sp-6C-4C"
827+
828+
reconstructed_kinetics = self.database.kinetics.reconstruct_kinetics_from_source(reactions[8], sources[8], fix_barrier_height=True)
829+
A = reconstructed_kinetics.A.value_si
830+
n = reconstructed_kinetics.n.value_si
831+
assert round(abs(reactions[8].kinetics.A.value_si - A), 7) == 0
832+
assert round(abs(reactions[8].kinetics.n.value_si - n), 7) == 0
833+
834+
# ------------------------------------------------------------------- #
835+
# Source 9 comes from a training reaction in an autogenerated tree
836+
assert "Training" in sources[9]
837+
assert sources[9]["Training"][0] == "Disproportionation"
838+
training_rxn = sources[9]["Training"][1]
839+
assert training_rxn.label == "CH3_r1 + C2H5 <=> CH4 + C2H4"
840+
841+
reconstructed_kinetics = self.database.kinetics.reconstruct_kinetics_from_source(reactions[9], sources[9], fix_barrier_height=True)
842+
A = reconstructed_kinetics.A.value_si
843+
n = reconstructed_kinetics.n.value_si
844+
assert round(abs(reactions[9].kinetics.A.value_si - A), 7) == 0
845+
assert round(abs(reactions[9].kinetics.n.value_si - n), 7) == 0
803846

804847
class TestKinetics:
805848
@classmethod

test/rmgpy/test_data/parsing_data/chem_annotated.inp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ SPECIES
2222
C2H6 ! C2H6
2323
C3H8 ! C3H8
2424
C2H3 ! C2H3
25+
CH3CHCH3 ! CH3CHCH3
26+
C3H6(28) ! C3H6(28)
27+
C3H5(41) ! C3H5(41)
28+
C3H5(43) ! C3H5(43)
2529
END
2630

2731

@@ -156,6 +160,30 @@ C2H3 C 2H 5 G 100.000 5000.000 900.33 1
156160
1.20640172E+04-2.91189784E+00 3.82177470E+00-3.43283353E-03 5.09227965E-05 3
157161
-6.20169997E-08 2.37053876E-11 1.30660155E+04 7.61665027E+00 4
158162

163+
! Thermo group additivity estimation: group(Cs-CsCsHH) + group(Cs-CsHHH) + group(Cs-CsHHH) + radical(CCJC)
164+
CH3CHCH3 C 3H 7 G 100.000 5000.000 1100.30 1
165+
3.65557541E+00 2.30584417E-02-9.41371372E-06 1.73592452E-09-1.20102267E-13 2
166+
8.11022490E+03 6.48192595E+00 3.21174698E+00 1.31075154E-02 1.99173550E-05 3
167+
-2.55877559E-08 8.25847355E-12 8.90792321E+03 1.18466459E+01 4
168+
169+
! Thermo group additivity estimation: group(Cs-(Cds-Cds)HHH) + group(Cds-CdsCsH) + group(Cds-CdsHH)
170+
C3H6(28) C 3H 6 G 100.000 5000.000 988.01 1
171+
5.41216484E+00 1.72863881E-02-6.51346939E-06 1.20319805E-09-8.55900632E-14 2
172+
-5.03227589E+02-4.80221171E+00 3.30974061E+00 8.27528424E-03 3.37704020E-05 3
173+
-4.39292610E-08 1.58765570E-11 7.67476915E+02 9.64360494E+00 4
174+
175+
! Thermo group additivity estimation: group(Cs-(Cds-Cds)HHH) + group(Cds-CdsCsH) + group(Cds-CdsHH) + radical(Allyl_P)
176+
C3H5(41) C 3H 5 G 100.000 5000.000 952.00 1
177+
7.55723004E+00 1.14809767E-02-3.63944718E-06 6.63565726E-10-4.95302876E-14 2
178+
1.71132508E+04-1.66628029E+01 3.31927862E+00 5.66515255E-03 4.27438657E-05 3
179+
-5.78817310E-08 2.21692287E-11 1.89906181E+04 9.19654133E+00 4
180+
181+
! Thermo group additivity estimation: group(Cs-(Cds-Cds)HHH) + group(Cds-CdsCsH) + group(Cds-CdsHH) + radical(Cds_P)
182+
C3H5(43) C 3H 5 G 100.000 5000.000 997.88 1
183+
5.66476488E+00 1.44325185E-02-5.46732691E-06 1.00156654E-09-7.04849453E-14 2
184+
2.93870628E+04-4.48542547E+00 3.23406836E+00 1.18209872E-02 1.70300218E-05 3
185+
-2.64359176E-08 9.91187847E-12 3.04873071E+04 1.03183254E+01 4
186+
159187
END
160188

161189

@@ -228,5 +256,28 @@ HCCO(23)(+M)=O(2)+C2H(21)(+M) 1.000e+00 0.000 0.000
228256
CHEB/ 4.629e-10 1.022e-09 -4.203e-02 -9.845e-09 -7.374e-09 /
229257
CHEB/ -2.262e-09 -1.025e-09 -3.546e-17 1.025e-09 2.262e-09 /
230258

259+
! Reaction index: Chemkin #25; RMG #97
260+
! Template reaction: Disproportionation
261+
! Flux pairs: CH3CHCH3, C3H6(28); C2H5(27), C2H6;
262+
! Estimated from node Root_Ext-2R!H-R_2R!H->C_4R->C
263+
! Multiplied by reaction path degeneracy 6.0
264+
C2H5(27)+CH3CHCH3<=>C2H6+C3H6(28) 3.000e+11 0.000 0.000
265+
266+
! Reaction index: Chemkin #72; RMG #276
267+
! Template reaction: Disproportionation
268+
! Flux pairs: CH2CH2CH2, C3H6(28); C3H5(43), C3H5(41);
269+
! Estimated from node Root_Ext-1R!H-R_N-4R->O_N-Sp-5R!H=1R!H_Ext-4CHNS-R_N-6R!H->S_4CHNS->C_N-
270+
! Sp-6BrBrBrCCCClClClFFFIIINNNOOOPPPSiSiSi#4C_6BrCClFINOPSi->C_N-1R!H-inRing_N-Sp-6C-4C
271+
! Multiplied by reaction path degeneracy 2.0
272+
C3H5(43)+CH2CH2CH2<=>C3H5(41)+C3H6(28) 2.420e+12 0.000 0.000
273+
274+
! Reaction index: Chemkin #4; RMG #37
275+
! Template reaction: Disproportionation
276+
! Flux pairs: C2H5(27), C2H4(26); CH3, CH4;
277+
! Matched reaction 5 CH3_r1 + C2H5 <=> CH4 + C2H4 in Disproportionation/training
278+
! This reaction matched rate rule [Root_N-4R->H_4CNOS-u1_N-1R!H->O_N-4CNOS->O_4CNS->C_1CNS->C_Sp-2R!H-1C_2R!H->C]
279+
! family: Disproportionation
280+
CH3+C2H5(27)<=>CH4+C2H4(26) 6.570e+14 -0.680 0.000
281+
231282
END
232283

test/rmgpy/test_data/parsing_data/species_dictionary.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,49 @@ multiplicity 2
155155
3 H u0 p0 c0 {1,S}
156156
4 H u0 p0 c0 {1,S}
157157
5 H u0 p0 c0 {2,S}
158+
159+
CH3CHCH3
160+
multiplicity 2
161+
1 C u0 p0 c0 {3,S} {4,S} {5,S} {6,S}
162+
2 C u0 p0 c0 {3,S} {7,S} {8,S} {9,S}
163+
3 C u1 p0 c0 {1,S} {2,S} {10,S}
164+
4 H u0 p0 c0 {1,S}
165+
5 H u0 p0 c0 {1,S}
166+
6 H u0 p0 c0 {1,S}
167+
7 H u0 p0 c0 {2,S}
168+
8 H u0 p0 c0 {2,S}
169+
9 H u0 p0 c0 {2,S}
170+
10 H u0 p0 c0 {3,S}
171+
172+
C3H6(28)
173+
1 C u0 p0 c0 {2,S} {4,S} {5,S} {6,S}
174+
2 C u0 p0 c0 {1,S} {3,D} {7,S}
175+
3 C u0 p0 c0 {2,D} {8,S} {9,S}
176+
4 H u0 p0 c0 {1,S}
177+
5 H u0 p0 c0 {1,S}
178+
6 H u0 p0 c0 {1,S}
179+
7 H u0 p0 c0 {2,S}
180+
8 H u0 p0 c0 {3,S}
181+
9 H u0 p0 c0 {3,S}
182+
183+
C3H5(41)
184+
multiplicity 2
185+
1 C u0 p0 c0 {2,S} {3,D} {4,S}
186+
2 C u1 p0 c0 {1,S} {7,S} {8,S}
187+
3 C u0 p0 c0 {1,D} {5,S} {6,S}
188+
4 H u0 p0 c0 {1,S}
189+
5 H u0 p0 c0 {3,S}
190+
6 H u0 p0 c0 {3,S}
191+
7 H u0 p0 c0 {2,S}
192+
8 H u0 p0 c0 {2,S}
193+
194+
C3H5(43)
195+
multiplicity 2
196+
1 C u0 p0 c0 {2,S} {4,S} {5,S} {6,S}
197+
2 C u0 p0 c0 {1,S} {3,D} {7,S}
198+
3 C u1 p0 c0 {2,D} {8,S}
199+
4 H u0 p0 c0 {1,S}
200+
5 H u0 p0 c0 {1,S}
201+
6 H u0 p0 c0 {1,S}
202+
7 H u0 p0 c0 {2,S}
203+
8 H u0 p0 c0 {3,S}

0 commit comments

Comments
 (0)