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

Database test #36

Merged
merged 15 commits into from
May 20, 2014
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
31 changes: 19 additions & 12 deletions EvaluateKinetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def getKineticsLeaveOneOut(family, missingGroups):

#returns the average temperature for the range given by the kinetic model
def getAverageTemp(kineticModel):
try:
return (kineticModel.Tmin.value + kineticModel.Tmax.value)/2
except AttributeError:
return 1000
# try:
# return (kineticModel.Tmin.value + kineticModel.Tmax.value)/2
# except AttributeError:
return 1000

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

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

def createParityPlot(parityData):
Expand Down Expand Up @@ -435,9 +435,16 @@ def checkFamilies(FullDatabase):
if True in problemsExist:
outputFile.write(family + '\n')
if problemsExist[0]:
outputFile.write('\n' + 'These groups exist in rules.py but not groups.py:' + '\n')
for group in problems[0]:
outputFile.write(group + '\n')
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')
for group, matchedGroups in problems[0].iteritems():
outputFile.write(group + ', Suggested match from groups.py: ')
for matchedGroup in matchedGroups:
if matchedGroup==matchedGroups[-1]:
if len(matchedGroups)>1:
outputFile.write('and ')
outputFile.write(matchedGroup + '\n')
else:
outputFile.write(matchedGroup +', ' )
if problemsExist[1]:
outputFile.write('\n' + 'These groups do not match the definition in the rule' + '\n')
for rule, groups in problems[1].iteritems():
Expand Down Expand Up @@ -475,17 +482,17 @@ def checkFamilies(FullDatabase):
outputFile.write('\n\n')
if __name__ == '__main__':


databaseProjectRootPath = os.path.dirname( os.path.abspath( __file__ ))
#Thermo stuff
# ThermoDatabase=ThermoDatabase()
# ThermoDatabase.load(path)
# ThermoDatabase.save(r'C:\RMG-database\input\thermo_test')
# ThermoDatabase.save(path)
FullDatabase=RMGDatabase()
# path=r'C:\RMG-database\input\thermo'
path='C:\RMG-database\input'
path = os.path.join(databaseProjectRootPath, 'input')
# FullDatabase.load(thermoLibraries=)
FullDatabase.load(path)
FullDatabase.load(path, kineticsFamilies='all')
checkFamilies(FullDatabase)
# trialDir=r'C:\Users\User1\Dropbox\Research\RMG\kinetics\LeaveOneOut\test'
# trialDir=r'C:\RMG-database\input_test'
Expand Down
74 changes: 37 additions & 37 deletions input/kinetics/families/1,2_Insertion/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
label = "carbene",
group =
"""
1 *1 C 2S {2,S} {3,S}
1 *1 Cs 2S {2,S} {3,S}
2 H 0 {1,S}
3 H 0 {1,S}
""",
Expand Down Expand Up @@ -194,7 +194,7 @@
label = "Cd_H",
group =
"""
1 *2 C 0 {2,D} {3,S} {4,S}
1 *2 Cd 0 {2,D} {3,S} {4,S}
2 C 0 {1,D}
3 *3 H 0 {1,S}
4 R 0 {1,S}
Expand All @@ -212,7 +212,7 @@
label = "Cd_pri",
group =
"""
1 *2 C 0 {2,D} {3,S} {4,S}
1 *2 Cd 0 {2,D} {3,S} {4,S}
2 C 0 {1,D}
3 *3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -230,8 +230,8 @@
label = "ethene",
group =
"""
1 *2 C 0 {2,D} {3,S} {4,S}
2 C 0 {1,D} {5,S} {6,S}
1 *2 Cd 0 {2,D} {3,S} {4,S}
2 Cd 0 {1,D} {5,S} {6,S}
3 *3 H 0 {1,S}
4 H 0 {1,S}
5 H 0 {2,S}
Expand All @@ -250,7 +250,7 @@
label = "Cd_sec",
group =
"""
1 *2 C 0 {2,D} {3,S} {4,S}
1 *2 Cd 0 {2,D} {3,S} {4,S}
2 C 0 {1,D}
3 *3 H 0 {1,S}
4 R!H 0 {1,S}
Expand All @@ -268,7 +268,7 @@
label = "Cd/H/NonDeC",
group =
"""
1 *2 C 0 {2,D} {3,S} {4,S}
1 *2 Cd 0 {2,D} {3,S} {4,S}
2 C 0 {1,D}
3 *3 H 0 {1,S}
4 Cs 0 {1,S}
Expand All @@ -286,7 +286,7 @@
label = "Cd/H/NonDeO",
group =
"""
1 *2 C 0 {2,D} {3,S} {4,S}
1 *2 Cd 0 {2,D} {3,S} {4,S}
2 C 0 {1,D}
3 *3 H 0 {1,S}
4 O 0 {1,S}
Expand All @@ -304,7 +304,7 @@
label = "Cd/H/OneDe",
group =
"""
1 *2 C 0 {2,D} {3,S} {4,S}
1 *2 Cd 0 {2,D} {3,S} {4,S}
2 C 0 {1,D}
3 *3 H 0 {1,S}
4 {Cd,Ct,Cb,CO} 0 {1,S}
Expand Down Expand Up @@ -340,7 +340,7 @@
label = "Cs_H",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 R 0 {1,S}
4 R 0 {1,S}
Expand All @@ -359,7 +359,7 @@
label = "C_methane",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -378,7 +378,7 @@
label = "C_pri",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -397,7 +397,7 @@
label = "C_pri/NonDeC",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -416,7 +416,7 @@
label = "C_pri/NonDeO",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -435,7 +435,7 @@
label = "C_pri/De",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -454,7 +454,7 @@
label = "C_pri/Cd",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -473,7 +473,7 @@
label = "C_pri/Ct",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 H 0 {1,S}
Expand All @@ -492,7 +492,7 @@
label = "C_sec",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 R!H 0 {1,S}
Expand All @@ -511,7 +511,7 @@
label = "C/H2/NonDeC",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 Cs 0 {1,S}
Expand All @@ -530,7 +530,7 @@
label = "C/H2/NonDeO",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 O 0 {1,S}
Expand All @@ -549,7 +549,7 @@
label = "C/H2/CsO",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 O 0 {1,S}
Expand All @@ -568,7 +568,7 @@
label = "C/H2/O2",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 O 0 {1,S}
Expand All @@ -587,7 +587,7 @@
label = "C/H2/OneDe",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 {Cd,Ct,CO,Cb} 0 {1,S}
Expand All @@ -606,7 +606,7 @@
label = "C/H2/OneDeC",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 {Cd,Ct,CO,Cb} 0 {1,S}
Expand All @@ -625,7 +625,7 @@
label = "C/H2/OneDeO",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 {Cd,Ct,CO,Cb} 0 {1,S}
Expand All @@ -644,7 +644,7 @@
label = "C/H2/TwoDe",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 H 0 {1,S}
4 {Cd,Ct,CO,Cb} 0 {1,S}
Expand All @@ -663,7 +663,7 @@
label = "C_ter",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 R!H 0 {1,S}
4 R!H 0 {1,S}
Expand All @@ -682,7 +682,7 @@
label = "C/H/NonDeC",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cs,O} 0 {1,S}
4 {Cs,O} 0 {1,S}
Expand All @@ -701,7 +701,7 @@
label = "C/H/Cs3",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 Cs 0 {1,S}
4 Cs 0 {1,S}
Expand All @@ -720,7 +720,7 @@
label = "C/H/NDMustO",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 O 0 {1,S}
4 {Cs,O} 0 {1,S}
Expand All @@ -739,7 +739,7 @@
label = "C/H/OneDe",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cd,Ct,Cb,CO} 0 {1,S}
4 {Cs,O} 0 {1,S}
Expand All @@ -758,7 +758,7 @@
label = "C/H/Cs2",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cd,Ct,Cb,CO} 0 {1,S}
4 Cs 0 {1,S}
Expand All @@ -777,7 +777,7 @@
label = "C/H/ODMustO",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cd,Ct,Cb,CO} 0 {1,S}
4 O 0 {1,S}
Expand All @@ -796,7 +796,7 @@
label = "C/H/TwoDe",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cd,Ct,Cb,CO} 0 {1,S}
4 {Cd,Ct,Cb,CO} 0 {1,S}
Expand All @@ -815,7 +815,7 @@
label = "C/H/Cs",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cd,Ct,Cb,CO} 0 {1,S}
4 {Cd,Ct,Cb,CO} 0 {1,S}
Expand All @@ -834,7 +834,7 @@
label = "C/H/TDMustO",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cd,Ct,Cb,CO} 0 {1,S}
4 {Cd,Ct,Cb,CO} 0 {1,S}
Expand All @@ -853,7 +853,7 @@
label = "C/H/ThreeDe",
group =
"""
1 *2 C 0 {2,S} {3,S} {4,S} {5,S}
1 *2 Cs 0 {2,S} {3,S} {4,S} {5,S}
2 *3 H 0 {1,S}
3 {Cd,Ct,Cb,CO} 0 {1,S}
4 {Cd,Ct,Cb,CO} 0 {1,S}
Expand Down
Loading