Skip to content

Commit a97bbd0

Browse files
committed
Merge pull request #36 from nyee/databaseTest
Database test
2 parents 2d444c2 + 82fe316 commit a97bbd0

File tree

16 files changed

+1295
-1312
lines changed

16 files changed

+1295
-1312
lines changed

EvaluateKinetics.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ def getKineticsLeaveOneOut(family, missingGroups):
107107

108108
#returns the average temperature for the range given by the kinetic model
109109
def getAverageTemp(kineticModel):
110-
try:
111-
return (kineticModel.Tmin.value + kineticModel.Tmax.value)/2
112-
except AttributeError:
113-
return 1000
110+
# try:
111+
# return (kineticModel.Tmin.value + kineticModel.Tmax.value)/2
112+
# except AttributeError:
113+
return 1000
114114

115115
#calculates the parity values for each
116116
def calculateParity(exactKineticModel, approxKineticModel, T):
@@ -130,7 +130,7 @@ def analyzeForParity(exactKinetics, approxKinetics, T=None, cutoff=0):
130130
exact=exactKinetics[key].getRateCoefficient(T)
131131
approx=approxKinetics[key].getRateCoefficient(T)
132132
dataPoint=[exact, approx]
133-
if cutoff!=0 and math.log((float(exact)/float(approx)))**2 > cutoff**2:
133+
if cutoff!=0 and math.log10((float(exact)/float(approx)))**2 > cutoff**2:
134134
continue
135135
parityData[key]=dataPoint
136136

@@ -143,7 +143,7 @@ def analyzeForParity(exactKinetics, approxKinetics, T=None, cutoff=0):
143143
def calculateQ(parityData):
144144
Q=0
145145
for key, value in parityData.iteritems():
146-
Q+=(math.log(value[0]/value[1]))**2
146+
Q+=(math.log10(value[0]/value[1]))**2
147147
return (Q/len(parityData))**0.5
148148

149149
def createParityPlot(parityData):
@@ -435,9 +435,16 @@ def checkFamilies(FullDatabase):
435435
if True in problemsExist:
436436
outputFile.write(family + '\n')
437437
if problemsExist[0]:
438-
outputFile.write('\n' + 'These groups exist in rules.py but not groups.py:' + '\n')
439-
for group in problems[0]:
440-
outputFile.write(group + '\n')
438+
outputFile.write('\n' + 'These groups exist in rules.py but not groups.py:' + '\n' + "A suggested match could be incorrect, but if 'No match' is written, it is true (and most unfortunate)" + '\n')
439+
for group, matchedGroups in problems[0].iteritems():
440+
outputFile.write(group + ', Suggested match from groups.py: ')
441+
for matchedGroup in matchedGroups:
442+
if matchedGroup==matchedGroups[-1]:
443+
if len(matchedGroups)>1:
444+
outputFile.write('and ')
445+
outputFile.write(matchedGroup + '\n')
446+
else:
447+
outputFile.write(matchedGroup +', ' )
441448
if problemsExist[1]:
442449
outputFile.write('\n' + 'These groups do not match the definition in the rule' + '\n')
443450
for rule, groups in problems[1].iteritems():
@@ -475,17 +482,17 @@ def checkFamilies(FullDatabase):
475482
outputFile.write('\n\n')
476483
if __name__ == '__main__':
477484

478-
485+
databaseProjectRootPath = os.path.dirname( os.path.abspath( __file__ ))
479486
#Thermo stuff
480487
# ThermoDatabase=ThermoDatabase()
481488
# ThermoDatabase.load(path)
482489
# ThermoDatabase.save(r'C:\RMG-database\input\thermo_test')
483490
# ThermoDatabase.save(path)
484491
FullDatabase=RMGDatabase()
485492
# path=r'C:\RMG-database\input\thermo'
486-
path='C:\RMG-database\input'
493+
path = os.path.join(databaseProjectRootPath, 'input')
487494
# FullDatabase.load(thermoLibraries=)
488-
FullDatabase.load(path)
495+
FullDatabase.load(path, kineticsFamilies='all')
489496
checkFamilies(FullDatabase)
490497
# trialDir=r'C:\Users\User1\Dropbox\Research\RMG\kinetics\LeaveOneOut\test'
491498
# trialDir=r'C:\RMG-database\input_test'

input/kinetics/families/1,2_Insertion/groups.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
label = "carbene",
6464
group =
6565
"""
66-
1 *1 C 2S {2,S} {3,S}
66+
1 *1 Cs 2S {2,S} {3,S}
6767
2 H 0 {1,S}
6868
3 H 0 {1,S}
6969
""",
@@ -194,7 +194,7 @@
194194
label = "Cd_H",
195195
group =
196196
"""
197-
1 *2 C 0 {2,D} {3,S} {4,S}
197+
1 *2 Cd 0 {2,D} {3,S} {4,S}
198198
2 C 0 {1,D}
199199
3 *3 H 0 {1,S}
200200
4 R 0 {1,S}
@@ -212,7 +212,7 @@
212212
label = "Cd_pri",
213213
group =
214214
"""
215-
1 *2 C 0 {2,D} {3,S} {4,S}
215+
1 *2 Cd 0 {2,D} {3,S} {4,S}
216216
2 C 0 {1,D}
217217
3 *3 H 0 {1,S}
218218
4 H 0 {1,S}
@@ -230,8 +230,8 @@
230230
label = "ethene",
231231
group =
232232
"""
233-
1 *2 C 0 {2,D} {3,S} {4,S}
234-
2 C 0 {1,D} {5,S} {6,S}
233+
1 *2 Cd 0 {2,D} {3,S} {4,S}
234+
2 Cd 0 {1,D} {5,S} {6,S}
235235
3 *3 H 0 {1,S}
236236
4 H 0 {1,S}
237237
5 H 0 {2,S}
@@ -250,7 +250,7 @@
250250
label = "Cd_sec",
251251
group =
252252
"""
253-
1 *2 C 0 {2,D} {3,S} {4,S}
253+
1 *2 Cd 0 {2,D} {3,S} {4,S}
254254
2 C 0 {1,D}
255255
3 *3 H 0 {1,S}
256256
4 R!H 0 {1,S}
@@ -268,7 +268,7 @@
268268
label = "Cd/H/NonDeC",
269269
group =
270270
"""
271-
1 *2 C 0 {2,D} {3,S} {4,S}
271+
1 *2 Cd 0 {2,D} {3,S} {4,S}
272272
2 C 0 {1,D}
273273
3 *3 H 0 {1,S}
274274
4 Cs 0 {1,S}
@@ -286,7 +286,7 @@
286286
label = "Cd/H/NonDeO",
287287
group =
288288
"""
289-
1 *2 C 0 {2,D} {3,S} {4,S}
289+
1 *2 Cd 0 {2,D} {3,S} {4,S}
290290
2 C 0 {1,D}
291291
3 *3 H 0 {1,S}
292292
4 O 0 {1,S}
@@ -304,7 +304,7 @@
304304
label = "Cd/H/OneDe",
305305
group =
306306
"""
307-
1 *2 C 0 {2,D} {3,S} {4,S}
307+
1 *2 Cd 0 {2,D} {3,S} {4,S}
308308
2 C 0 {1,D}
309309
3 *3 H 0 {1,S}
310310
4 {Cd,Ct,Cb,CO} 0 {1,S}
@@ -340,7 +340,7 @@
340340
label = "Cs_H",
341341
group =
342342
"""
343-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
343+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
344344
2 *3 H 0 {1,S}
345345
3 R 0 {1,S}
346346
4 R 0 {1,S}
@@ -359,7 +359,7 @@
359359
label = "C_methane",
360360
group =
361361
"""
362-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
362+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
363363
2 *3 H 0 {1,S}
364364
3 H 0 {1,S}
365365
4 H 0 {1,S}
@@ -378,7 +378,7 @@
378378
label = "C_pri",
379379
group =
380380
"""
381-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
381+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
382382
2 *3 H 0 {1,S}
383383
3 H 0 {1,S}
384384
4 H 0 {1,S}
@@ -397,7 +397,7 @@
397397
label = "C_pri/NonDeC",
398398
group =
399399
"""
400-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
400+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
401401
2 *3 H 0 {1,S}
402402
3 H 0 {1,S}
403403
4 H 0 {1,S}
@@ -416,7 +416,7 @@
416416
label = "C_pri/NonDeO",
417417
group =
418418
"""
419-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
419+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
420420
2 *3 H 0 {1,S}
421421
3 H 0 {1,S}
422422
4 H 0 {1,S}
@@ -435,7 +435,7 @@
435435
label = "C_pri/De",
436436
group =
437437
"""
438-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
438+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
439439
2 *3 H 0 {1,S}
440440
3 H 0 {1,S}
441441
4 H 0 {1,S}
@@ -454,7 +454,7 @@
454454
label = "C_pri/Cd",
455455
group =
456456
"""
457-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
457+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
458458
2 *3 H 0 {1,S}
459459
3 H 0 {1,S}
460460
4 H 0 {1,S}
@@ -473,7 +473,7 @@
473473
label = "C_pri/Ct",
474474
group =
475475
"""
476-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
476+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
477477
2 *3 H 0 {1,S}
478478
3 H 0 {1,S}
479479
4 H 0 {1,S}
@@ -492,7 +492,7 @@
492492
label = "C_sec",
493493
group =
494494
"""
495-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
495+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
496496
2 *3 H 0 {1,S}
497497
3 H 0 {1,S}
498498
4 R!H 0 {1,S}
@@ -511,7 +511,7 @@
511511
label = "C/H2/NonDeC",
512512
group =
513513
"""
514-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
514+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
515515
2 *3 H 0 {1,S}
516516
3 H 0 {1,S}
517517
4 Cs 0 {1,S}
@@ -530,7 +530,7 @@
530530
label = "C/H2/NonDeO",
531531
group =
532532
"""
533-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
533+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
534534
2 *3 H 0 {1,S}
535535
3 H 0 {1,S}
536536
4 O 0 {1,S}
@@ -549,7 +549,7 @@
549549
label = "C/H2/CsO",
550550
group =
551551
"""
552-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
552+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
553553
2 *3 H 0 {1,S}
554554
3 H 0 {1,S}
555555
4 O 0 {1,S}
@@ -568,7 +568,7 @@
568568
label = "C/H2/O2",
569569
group =
570570
"""
571-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
571+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
572572
2 *3 H 0 {1,S}
573573
3 H 0 {1,S}
574574
4 O 0 {1,S}
@@ -587,7 +587,7 @@
587587
label = "C/H2/OneDe",
588588
group =
589589
"""
590-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
590+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
591591
2 *3 H 0 {1,S}
592592
3 H 0 {1,S}
593593
4 {Cd,Ct,CO,Cb} 0 {1,S}
@@ -606,7 +606,7 @@
606606
label = "C/H2/OneDeC",
607607
group =
608608
"""
609-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
609+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
610610
2 *3 H 0 {1,S}
611611
3 H 0 {1,S}
612612
4 {Cd,Ct,CO,Cb} 0 {1,S}
@@ -625,7 +625,7 @@
625625
label = "C/H2/OneDeO",
626626
group =
627627
"""
628-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
628+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
629629
2 *3 H 0 {1,S}
630630
3 H 0 {1,S}
631631
4 {Cd,Ct,CO,Cb} 0 {1,S}
@@ -644,7 +644,7 @@
644644
label = "C/H2/TwoDe",
645645
group =
646646
"""
647-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
647+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
648648
2 *3 H 0 {1,S}
649649
3 H 0 {1,S}
650650
4 {Cd,Ct,CO,Cb} 0 {1,S}
@@ -663,7 +663,7 @@
663663
label = "C_ter",
664664
group =
665665
"""
666-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
666+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
667667
2 *3 H 0 {1,S}
668668
3 R!H 0 {1,S}
669669
4 R!H 0 {1,S}
@@ -682,7 +682,7 @@
682682
label = "C/H/NonDeC",
683683
group =
684684
"""
685-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
685+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
686686
2 *3 H 0 {1,S}
687687
3 {Cs,O} 0 {1,S}
688688
4 {Cs,O} 0 {1,S}
@@ -701,7 +701,7 @@
701701
label = "C/H/Cs3",
702702
group =
703703
"""
704-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
704+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
705705
2 *3 H 0 {1,S}
706706
3 Cs 0 {1,S}
707707
4 Cs 0 {1,S}
@@ -720,7 +720,7 @@
720720
label = "C/H/NDMustO",
721721
group =
722722
"""
723-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
723+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
724724
2 *3 H 0 {1,S}
725725
3 O 0 {1,S}
726726
4 {Cs,O} 0 {1,S}
@@ -739,7 +739,7 @@
739739
label = "C/H/OneDe",
740740
group =
741741
"""
742-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
742+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
743743
2 *3 H 0 {1,S}
744744
3 {Cd,Ct,Cb,CO} 0 {1,S}
745745
4 {Cs,O} 0 {1,S}
@@ -758,7 +758,7 @@
758758
label = "C/H/Cs2",
759759
group =
760760
"""
761-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
761+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
762762
2 *3 H 0 {1,S}
763763
3 {Cd,Ct,Cb,CO} 0 {1,S}
764764
4 Cs 0 {1,S}
@@ -777,7 +777,7 @@
777777
label = "C/H/ODMustO",
778778
group =
779779
"""
780-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
780+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
781781
2 *3 H 0 {1,S}
782782
3 {Cd,Ct,Cb,CO} 0 {1,S}
783783
4 O 0 {1,S}
@@ -796,7 +796,7 @@
796796
label = "C/H/TwoDe",
797797
group =
798798
"""
799-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
799+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
800800
2 *3 H 0 {1,S}
801801
3 {Cd,Ct,Cb,CO} 0 {1,S}
802802
4 {Cd,Ct,Cb,CO} 0 {1,S}
@@ -815,7 +815,7 @@
815815
label = "C/H/Cs",
816816
group =
817817
"""
818-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
818+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
819819
2 *3 H 0 {1,S}
820820
3 {Cd,Ct,Cb,CO} 0 {1,S}
821821
4 {Cd,Ct,Cb,CO} 0 {1,S}
@@ -834,7 +834,7 @@
834834
label = "C/H/TDMustO",
835835
group =
836836
"""
837-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
837+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
838838
2 *3 H 0 {1,S}
839839
3 {Cd,Ct,Cb,CO} 0 {1,S}
840840
4 {Cd,Ct,Cb,CO} 0 {1,S}
@@ -853,7 +853,7 @@
853853
label = "C/H/ThreeDe",
854854
group =
855855
"""
856-
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
856+
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
857857
2 *3 H 0 {1,S}
858858
3 {Cd,Ct,Cb,CO} 0 {1,S}
859859
4 {Cd,Ct,Cb,CO} 0 {1,S}

0 commit comments

Comments
 (0)