10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

replace firstState by initialState

This commit is contained in:
Mickaël Véril 2020-06-25 16:46:33 +02:00
parent 2bb908c042
commit 6f15d73054
9 changed files with 106 additions and 106 deletions

View File

@ -6,14 +6,14 @@
\newcommand{\Td}{\%T_1} \newcommand{\Td}{\%T_1}
\begin{dfbOptions} \begin{dfbOptions}
\format{exoticcolumn} \format{exoticcolumn}
\firstState[\ce{CClF}]{^1A^\prime} \initialState[\ce{CClF}]{^1A^\prime}
\firstState[Formylfluoride]{^1A^\prime} \initialState[Formylfluoride]{^1A^\prime}
\firstState[\ce{HCCl}]{^1A^\prime} \initialState[\ce{HCCl}]{^1A^\prime}
\firstState[\ce{HCF}]{^1A^\prime} \initialState[\ce{HCF}]{^1A^\prime}
\firstState[\ce{HCP}]{^1\Sigma^+} \initialState[\ce{HCP}]{^1\Sigma^+}
\firstState[\ce{HPO}]{^1A^\prime} \initialState[\ce{HPO}]{^1A^\prime}
\firstState[\ce{HPS}]{^1A^\prime} \initialState[\ce{HPS}]{^1A^\prime}
\firstState[\ce{HSiF}]{^1A^\prime} \initialState[\ce{HSiF}]{^1A^\prime}
\end{dfbOptions} \end{dfbOptions}
\begin{tabular} \begin{tabular}

View File

@ -1,14 +1,14 @@
\begin{dfbOptions} \begin{dfbOptions}
\format{Column} \format{Column}
\firstState[Acetaldehyde]{^1A^\prime} \initialState[Acetaldehyde]{^1A^\prime}
\firstState[Acetylene]{^1\Sigma_g} \initialState[Acetylene]{^1\Sigma_g}
\firstState[Carbon monoxide]{^1\Sigma^+} \initialState[Carbon monoxide]{^1\Sigma^+}
\firstState[Dinitrogen]{^1\Sigma_g} \initialState[Dinitrogen]{^1\Sigma_g}
\firstState[Ethylene]{^1A_g} \initialState[Ethylene]{^1A_g}
\firstState[Formamide]{^1A^\prime} \initialState[Formamide]{^1A^\prime}
\firstState[Hydrogen chloride]{^1\Sigma^+} \initialState[Hydrogen chloride]{^1\Sigma^+}
\firstState[Methanimine]{^1A^\prime} \initialState[Methanimine]{^1A^\prime}
\firstState[Nitrosomethane]{^1A^\prime} \initialState[Nitrosomethane]{^1A^\prime}
\end{dfbOptions} \end{dfbOptions}
\begin{tabular} \begin{tabular}

View File

@ -35,20 +35,20 @@
\begin{dfbOptions} \begin{dfbOptions}
\format{Column} \format{Column}
\firstState[Acrolein]{^1A^\prime} \initialState[Acrolein]{^1A^\prime}
\firstState[Benzene]{^1A_{1g}} \initialState[Benzene]{^1A_{1g}}
\firstState[Butadiene]{^1A_g} \initialState[Butadiene]{^1A_g}
\firstState[Cyanoacetylene]{^1\Sigma^+}} \initialState[Cyanoacetylene]{^1\Sigma^+}}
\firstState[Cyanoformaldehyde]{^1A^\prime} \initialState[Cyanoformaldehyde]{^1A^\prime}
\firstState[Cyanogen]{^1\Sigma_g^+} \initialState[Cyanogen]{^1\Sigma_g^+}
\firstState[Diacetylene]{^1A^\prime} \initialState[Diacetylene]{^1A^\prime}
\firstState[Glyoxal]{^1A_g} \initialState[Glyoxal]{^1A_g}
\firstState[Imidazole]{^1A^\prime} \initialState[Imidazole]{^1A^\prime}
\firstState[Propynal]{^1A^\prime} \initialState[Propynal]{^1A^\prime}
\firstState[Pyrazine]{^1A_g} \initialState[Pyrazine]{^1A_g}
\firstState[Tetrazine]{^1A_g} \initialState[Tetrazine]{^1A_g}
\firstState[Thiopropynal]{^1A^\prime} \initialState[Thiopropynal]{^1A^\prime}
\firstState[Triazine]{^1A^\prime} \initialState[Triazine]{^1A^\prime}
\end{dfbOptions} \end{dfbOptions}
\begin{tabular} \begin{tabular}

View File

@ -26,14 +26,14 @@
\newcommand{\DAVPZ}{d-aug-cc-pV5Z} \newcommand{\DAVPZ}{d-aug-cc-pV5Z}
\begin{dfbOptions} \begin{dfbOptions}
\format{exoticcolumn} \format{exoticcolumn}
\firstState[\ce{CClF}]{^1A^\prime} \initialState[\ce{CClF}]{^1A^\prime}
\firstState[Formylfluoride]{^1A^\prime} \initialState[Formylfluoride]{^1A^\prime}
\firstState[\ce{HCCl}]{^1A^\prime} \initialState[\ce{HCCl}]{^1A^\prime}
\firstState[\ce{HCF}]{^1A^\prime} \initialState[\ce{HCF}]{^1A^\prime}
\firstState[\ce{HCP}]{^1\Sigma^+} \initialState[\ce{HCP}]{^1\Sigma^+}
\firstState[\ce{HPO}]{^1A^\prime} \initialState[\ce{HPO}]{^1A^\prime}
\firstState[\ce{HPS}]{^1A^\prime} \initialState[\ce{HPS}]{^1A^\prime}
\firstState[\ce{HSiF}]{^1A^\prime} \initialState[\ce{HSiF}]{^1A^\prime}
\end{dfbOptions} \end{dfbOptions}

View File

@ -26,14 +26,14 @@
\newcommand{\DAVPZ}{d-aug-cc-pV5Z} \newcommand{\DAVPZ}{d-aug-cc-pV5Z}
\begin{dfbOptions} \begin{dfbOptions}
\format{exoticcolumn} \format{exoticcolumn}
\firstState[\ce{CClF}]{^1A^\prime} \initialState[\ce{CClF}]{^1A^\prime}
\firstState[Formylfluoride]{^1A^\prime} \initialState[Formylfluoride]{^1A^\prime}
\firstState[\ce{HCCl}]{^1A^\prime} \initialState[\ce{HCCl}]{^1A^\prime}
\firstState[\ce{HCF}]{^1A^\prime} \initialState[\ce{HCF}]{^1A^\prime}
\firstState[\ce{HCP}]{^1\Sigma^+} \initialState[\ce{HCP}]{^1\Sigma^+}
\firstState[\ce{HPO}]{^1A^\prime} \initialState[\ce{HPO}]{^1A^\prime}
\firstState[\ce{HPS}]{^1A^\prime} \initialState[\ce{HPS}]{^1A^\prime}
\firstState[\ce{HSiF}]{^1A^\prime} \initialState[\ce{HSiF}]{^1A^\prime}
\end{dfbOptions} \end{dfbOptions}
\begin{tabular} \begin{tabular}

View File

@ -26,29 +26,29 @@
\newcommand{\DAVPZ}{d-aug-cc-pV5Z} \newcommand{\DAVPZ}{d-aug-cc-pV5Z}
\begin{dfbOptions} \begin{dfbOptions}
\format{exoticcolumn} \format{exoticcolumn}
\firstState{^2A_1} \initialState{^2A_1}
\firstState[Allyl]{^2A_2} \initialState[Allyl]{^2A_2}
\firstState[\ce{BeF}]{^2\Sigma^+} \initialState[\ce{BeF}]{^2\Sigma^+}
\firstState[\ce{BeF}]{^2\Sigma^+} \initialState[\ce{BeF}]{^2\Sigma^+}
\firstState[\ce{BeH}]{^2\Sigma^+} \initialState[\ce{BeH}]{^2\Sigma^+}
\firstState[\ce{CH}]{^2\Pi} \initialState[\ce{CH}]{^2\Pi}
\firstState[\ce{CH3}]{^2A_2^{\prime\prime}} \initialState[\ce{CH3}]{^2A_2^{\prime\prime}}
\firstState[\ce{CN}]{^2\Sigma^+} \initialState[\ce{CN}]{^2\Sigma^+}
\firstState[\ce{CNO}]{^2\Sigma^+} \initialState[\ce{CNO}]{^2\Sigma^+}
\firstState[\ce{CO+}]{^2\Sigma^+} \initialState[\ce{CO+}]{^2\Sigma^+}
\firstState[\ce{F2BO}]{^2B_2} \initialState[\ce{F2BO}]{^2B_2}
\firstState[\ce{H2BO}]{^2B_2} \initialState[\ce{H2BO}]{^2B_2}
\firstState[\ce{HCO}]{^2A^\prime} \initialState[\ce{HCO}]{^2A^\prime}
\firstState[\ce{HOC}]{^2A^\prime} \initialState[\ce{HOC}]{^2A^\prime}
\firstState[\ce{H2PO}]{^2A^\prime} \initialState[\ce{H2PO}]{^2A^\prime}
\firstState[\ce{H2PS}]{^2A^\prime} \initialState[\ce{H2PS}]{^2A^\prime}
\firstState[\ce{NCO}]{^2\Pi} \initialState[\ce{NCO}]{^2\Pi}
\firstState[\ce{NH2}]{^2B_1} \initialState[\ce{NH2}]{^2B_1}
\firstState[Nitromethyl]{^2B_1} \initialState[Nitromethyl]{^2B_1}
\firstState[\ce{NO}]{^2B_1} \initialState[\ce{NO}]{^2B_1}
\firstState[\ce{OH}]{^2\Pi} \initialState[\ce{OH}]{^2\Pi}
\firstState[\ce{PH2}]{^2B_1} \initialState[\ce{PH2}]{^2B_1}
\firstState[Vinyl]{^2A^{\prime\prime}} \initialState[Vinyl]{^2A^{\prime\prime}}
\end{dfbOptions} \end{dfbOptions}
\begin{tabular} \begin{tabular}

View File

@ -30,15 +30,15 @@
\begin{dfbOptions} \begin{dfbOptions}
\format{TBE} \format{TBE}
\firstState[Acetaldehyde]{^1A^\prime} \initialState[Acetaldehyde]{^1A^\prime}
\firstState[Acetylene]{^1\Sigma_g} \initialState[Acetylene]{^1\Sigma_g}
\firstState[Carbon monoxyde]{^1\Sigma^+} \initialState[Carbon monoxyde]{^1\Sigma^+}
\firstState[Dinitrogen]{^1\Sigma^+} \initialState[Dinitrogen]{^1\Sigma^+}
\firstState[Ethylene]{^1A_g} \initialState[Ethylene]{^1A_g}
\firstState[Formamide]{^1A^\prime} \initialState[Formamide]{^1A^\prime}
\firstState[Hydrogen chloride]{^1A^\prime} \initialState[Hydrogen chloride]{^1A^\prime}
\firstState[Methanimine]{^1A^\prime} \initialState[Methanimine]{^1A^\prime}
\firstState[Nitrosomethane]{^1A^\prime} \initialState[Nitrosomethane]{^1A^\prime}
\end{dfbOptions} \end{dfbOptions}
\begin{tabular}{llcccccc} \begin{tabular}{llcccccc}
& & & & TBE(FC)& \multicolumn{3}{c}{Corrected TBE} \\ & & & & TBE(FC)& \multicolumn{3}{c}{Corrected TBE} \\

View File

@ -17,7 +17,7 @@ args = parser.parse_args()
lines=args.file.readlines() lines=args.file.readlines()
soup=TexSoup(lines) soup=TexSoup(lines)
opt=soup.dfbOptions opt=soup.dfbOptions
dfb_Opt= {"defaultType":DataType.ABS,"format":Format.LINE,"suffix":None,"firstStates":defaultdict(lambda : state(1,1,"A_1"))} dfb_Opt= {"defaultType":DataType.ABS,"format":Format.LINE,"suffix":None,"initialStates":defaultdict(lambda : state(1,1,"A_1"))}
dfbDefaultTypeNode=opt.defaultType dfbDefaultTypeNode=opt.defaultType
if dfbDefaultTypeNode!=None: if dfbDefaultTypeNode!=None:
dfbDefaultType=dfbDefaultTypeNode.expr dfbDefaultType=dfbDefaultTypeNode.expr
@ -35,18 +35,18 @@ if dfbSuffixNode!=None:
dfbSuffix=dfbSuffixNode.expr dfbSuffix=dfbSuffixNode.expr
if type(dfbSuffix) is TexCmd: if type(dfbSuffix) is TexCmd:
dfb_Opt["suffix"]=dfbSuffix.args[0].value dfb_Opt["suffix"]=dfbSuffix.args[0].value
dfbFirstStateNodes=list(opt.find_all("firstState")) dfbInitialStateNodes=list(opt.find_all("initialState"))
for node in dfbFirstStateNodes: for node in dfbInitialStateNodes:
firstState=node.expr initialState=node.expr
if type(firstState) is TexCmd: if type(initialState) is TexCmd:
vRArgs=[arg.value for arg in firstState.args if arg.type=="required"] vRArgs=[arg.value for arg in initialState.args if arg.type=="required"]
vOArgs=[arg.value for arg in firstState.args if arg.type=="optional"] vOArgs=[arg.value for arg in initialState.args if arg.type=="optional"]
if len(vOArgs)==0: if len(vOArgs)==0:
defaultstate=state.fromString("1 "+vRArgs[0]) defaultstate=state.fromString("1 "+vRArgs[0])
dfb_Opt["firstStates"].default_factory=lambda : defaultstate dfb_Opt["initialStates"].default_factory=lambda : defaultstate
else: else:
mystate=state.fromString("1 "+vRArgs[0]) mystate=state.fromString("1 "+vRArgs[0])
dfb_Opt["firstStates"][vOArgs[0]]=mystate dfb_Opt["initialStates"][vOArgs[0]]=mystate
commands=[LaTeX.newCommand(cmd) for cmd in soup.find_all("newcommand")] commands=[LaTeX.newCommand(cmd) for cmd in soup.find_all("newcommand")]
dat=LaTeX.tabularToData(soup.tabular,commands) dat=LaTeX.tabularToData(soup.tabular,commands)
scriptpath=Path(sys.argv[0]).resolve() scriptpath=Path(sys.argv[0]).resolve()
@ -55,6 +55,6 @@ if args.debug:
datapath=datapath/"test" datapath=datapath/"test"
if not datapath.exists(): if not datapath.exists():
datapath.mkdir() datapath.mkdir()
datalst=dataFileBase.readFromTable(dat,dfb_Opt["firstStates"],format=dfb_Opt["format"],default=dfb_Opt["defaultType"],commands=commands) datalst=dataFileBase.readFromTable(dat,dfb_Opt["initialStates"],format=dfb_Opt["format"],default=dfb_Opt["defaultType"],commands=commands)
for data in datalst: for data in datalst:
data.toFile(datapath,dfb_Opt["suffix"]) data.toFile(datapath,dfb_Opt["suffix"])

View File

@ -43,7 +43,7 @@ class dataFileBase(object):
pass pass
@staticmethod @staticmethod
def convertState(StateTablelist,firstState,default=DataType.ABS,commands=[]): def convertState(StateTablelist,initialState,default=DataType.ABS,commands=[]):
tmplst=[] tmplst=[]
for TexState in StateTablelist: for TexState in StateTablelist:
math=TexState.find("$") math=TexState.find("$")
@ -70,14 +70,14 @@ class dataFileBase(object):
tmplst.append((mul,symm,trsp,tygrp)) tmplst.append((mul,symm,trsp,tygrp))
lst=[] lst=[]
for index,item in enumerate(tmplst): for index,item in enumerate(tmplst):
unformfirststate=(firstState.multiplicity,firstState.symetry) unforminitialstate=(initialState.multiplicity,initialState.symetry)
countlst=[unformfirststate]+[(it[0],it[1]) for it in tmplst[:index+1]] countlst=[unforminitialstate]+[(it[0],it[1]) for it in tmplst[:index+1]]
countitem=(item[0],item[1]) countitem=(item[0],item[1])
count=countlst.count(countitem) count=countlst.count(countitem)
lst.append((state(count,item[0],item[1]),item[2],item[3])) lst.append((state(count,item[0],item[1]),item[2],item[3]))
return lst return lst
@staticmethod @staticmethod
def readFromTable(table,firstStates,format=Format.LINE,default=DataType.ABS, commands=[]): def readFromTable(table,initialStates,format=Format.LINE,default=DataType.ABS, commands=[]):
def getSubtableIndex(table,firstindex=2,column=0,count=1): def getSubtableIndex(table,firstindex=2,column=0,count=1):
subtablesindex=list() subtablesindex=list()
i=firstindex+count i=firstindex+count
@ -101,8 +101,8 @@ class dataFileBase(object):
col=table[:,col] col=table[:,col]
mymolecule=str(col[0]) mymolecule=str(col[0])
mymethod=method(str(col[2]),str(col[1])) mymethod=method(str(col[2]),str(col[1]))
firstState=firstStates[mymolecule] initialState=initialStates[mymolecule]
finsts=dataFileBase.convertState(table[3:,0],firstState,default=default,commands=commands) finsts=dataFileBase.convertState(table[3:,0],initialState,default=default,commands=commands)
datacls=dict() datacls=dict()
for index,cell in enumerate(col[3:]): for index,cell in enumerate(col[3:]):
if str(cell)!="": if str(cell)!="":
@ -117,7 +117,7 @@ class dataFileBase(object):
datacls[dt]=data datacls[dt]=data
data.molecule=mymolecule data.molecule=mymolecule
data.method=mymethod data.method=mymethod
data.excitations.append(excitationValue(firstState,finst[0],val,type=finst[2],isUnsafe=unsafe)) data.excitations.append(excitationValue(initialState,finst[0],val,type=finst[2],isUnsafe=unsafe))
for value in datacls.values(): for value in datacls.values():
datalist.append(value) datalist.append(value)
return datalist return datalist
@ -128,9 +128,9 @@ class dataFileBase(object):
datacls=dict() datacls=dict()
col=table[:,col] col=table[:,col]
mymolecule=str(table[first,0]) mymolecule=str(table[first,0])
firstState=firstStates[mymolecule] initialState=initialStates[mymolecule]
mymethod=method(str(col[1]),str(col[0])) mymethod=method(str(col[1]),str(col[0]))
finsts=dataFileBase.convertState(table[first:last+1,1],firstState,default=default,commands=commands) finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=default,commands=commands)
for index,cell in enumerate(col[first:last+1]): for index,cell in enumerate(col[first:last+1]):
if str(cell)!="": if str(cell)!="":
val,unsafe=getValFromCell(cell) val,unsafe=getValFromCell(cell)
@ -144,7 +144,7 @@ class dataFileBase(object):
data.molecule=mymolecule data.molecule=mymolecule
data.method=mymethod data.method=mymethod
datacls[dt]=data datacls[dt]=data
data.excitations.append(excitationValue(firstState,finst[0],val,type=finst[2])) data.excitations.append(excitationValue(initialState,finst[0],val,type=finst[2]))
for value in datacls.values(): for value in datacls.values():
datalist.append(value) datalist.append(value)
return datalist return datalist
@ -209,7 +209,7 @@ class dataFileBase(object):
for first, last in subtablesindex: for first, last in subtablesindex:
valDic=dict() valDic=dict()
mymolecule=str(table[first,0]) mymolecule=str(table[first,0])
firstState=firstStates[mymolecule] initialState=initialStates[mymolecule]
for col in range(2,np.size(table,1)): for col in range(2,np.size(table,1)):
col=table[:,col] col=table[:,col]
basis=str(col[0]) basis=str(col[0])
@ -228,7 +228,7 @@ class dataFileBase(object):
methodname=str(methtex) methodname=str(methtex)
mymethod=method(methodname,basis) mymethod=method(methodname,basis)
methkey=json.dumps(mymethod.__dict__) methkey=json.dumps(mymethod.__dict__)
finsts=dataFileBase.convertState(table[first:last+1,1],firstState,default=default,commands=commands) finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=default,commands=commands)
for index,cell in enumerate(col[first:last+1]): for index,cell in enumerate(col[first:last+1]):
if str(cell)!="": if str(cell)!="":
val,unsafe=getValFromCell(cell) val,unsafe=getValFromCell(cell)
@ -249,7 +249,7 @@ class dataFileBase(object):
dataDic[exkey][kind]=(val,unsafe) dataDic[exkey][kind]=(val,unsafe)
else: else:
dataDic[exkey][kind]=val dataDic[exkey][kind]=val
#data.excitations.append(excitationValue(firstState,finst[0],val,type=finst[2])) #data.excitations.append(excitationValue(initialState,finst[0],val,type=finst[2]))
for dt,methdic in valDic.items(): for dt,methdic in valDic.items():
for methstring,exdic in methdic.items(): for methstring,exdic in methdic.items():
data=switcher[dt]() data=switcher[dt]()
@ -263,7 +263,7 @@ class dataFileBase(object):
T1=values["\\%T_1"] if "\\%T_1" in values else None T1=values["\\%T_1"] if "\\%T_1" in values else None
oF= values["f"] if "f" in values else None oF= values["f"] if "f" in values else None
val,unsafe=values[""] val,unsafe=values[""]
data.excitations.append(excitationValue(firstState,st,val,type=ty,T1=T1,isUnsafe=unsafe,oscilatorForces=oF)) data.excitations.append(excitationValue(initialState,st,val,type=ty,T1=T1,isUnsafe=unsafe,oscilatorForces=oF))
datalist.append(data) datalist.append(data)
return datalist return datalist
elif format==Format.TBE: elif format==Format.TBE:
@ -271,9 +271,9 @@ class dataFileBase(object):
for first, last in subtablesindex: for first, last in subtablesindex:
datacls=dict() datacls=dict()
mymolecule=str(table[first,0]) mymolecule=str(table[first,0])
firstState=firstStates[mymolecule] initialState=initialStates[mymolecule]
mymethod=(method("TBE(FC)"),method("TBE")) mymethod=(method("TBE(FC)"),method("TBE"))
finsts=dataFileBase.convertState(table[first:last+1,1],firstState,default=default,commands=commands) finsts=dataFileBase.convertState(table[first:last+1,1],initialState,default=default,commands=commands)
for index,row in enumerate(table[first:last+1,]): for index,row in enumerate(table[first:last+1,]):
oscilatorForces=checkFloat(str(row[2])) oscilatorForces=checkFloat(str(row[2]))
T1 = checkFloat(str(row[3])) T1 = checkFloat(str(row[3]))
@ -295,7 +295,7 @@ class dataFileBase(object):
vs=[val,corr] vs=[val,corr]
uns=[unsafe,unsafecorr] uns=[unsafe,unsafecorr]
for i in range(2): for i in range(2):
datamtbe[i].excitations.append(excitationValue(firstState,finst[0],vs[i],type=finst[2],T1=T1,oscilatorForces=oscilatorForces,isUnsafe=uns[i])) datamtbe[i].excitations.append(excitationValue(initialState,finst[0],vs[i],type=finst[2],T1=T1,oscilatorForces=oscilatorForces,isUnsafe=uns[i]))
for value in datacls.values(): for value in datacls.values():
for dat in value: for dat in value:
datalist.append(dat) datalist.append(dat)