10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +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}
\begin{dfbOptions}
\format{exoticcolumn}
\firstState[\ce{CClF}]{^1A^\prime}
\firstState[Formylfluoride]{^1A^\prime}
\firstState[\ce{HCCl}]{^1A^\prime}
\firstState[\ce{HCF}]{^1A^\prime}
\firstState[\ce{HCP}]{^1\Sigma^+}
\firstState[\ce{HPO}]{^1A^\prime}
\firstState[\ce{HPS}]{^1A^\prime}
\firstState[\ce{HSiF}]{^1A^\prime}
\initialState[\ce{CClF}]{^1A^\prime}
\initialState[Formylfluoride]{^1A^\prime}
\initialState[\ce{HCCl}]{^1A^\prime}
\initialState[\ce{HCF}]{^1A^\prime}
\initialState[\ce{HCP}]{^1\Sigma^+}
\initialState[\ce{HPO}]{^1A^\prime}
\initialState[\ce{HPS}]{^1A^\prime}
\initialState[\ce{HSiF}]{^1A^\prime}
\end{dfbOptions}
\begin{tabular}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ args = parser.parse_args()
lines=args.file.readlines()
soup=TexSoup(lines)
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
if dfbDefaultTypeNode!=None:
dfbDefaultType=dfbDefaultTypeNode.expr
@ -35,18 +35,18 @@ if dfbSuffixNode!=None:
dfbSuffix=dfbSuffixNode.expr
if type(dfbSuffix) is TexCmd:
dfb_Opt["suffix"]=dfbSuffix.args[0].value
dfbFirstStateNodes=list(opt.find_all("firstState"))
for node in dfbFirstStateNodes:
firstState=node.expr
if type(firstState) is TexCmd:
vRArgs=[arg.value for arg in firstState.args if arg.type=="required"]
vOArgs=[arg.value for arg in firstState.args if arg.type=="optional"]
dfbInitialStateNodes=list(opt.find_all("initialState"))
for node in dfbInitialStateNodes:
initialState=node.expr
if type(initialState) is TexCmd:
vRArgs=[arg.value for arg in initialState.args if arg.type=="required"]
vOArgs=[arg.value for arg in initialState.args if arg.type=="optional"]
if len(vOArgs)==0:
defaultstate=state.fromString("1 "+vRArgs[0])
dfb_Opt["firstStates"].default_factory=lambda : defaultstate
dfb_Opt["initialStates"].default_factory=lambda : defaultstate
else:
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")]
dat=LaTeX.tabularToData(soup.tabular,commands)
scriptpath=Path(sys.argv[0]).resolve()
@ -55,6 +55,6 @@ if args.debug:
datapath=datapath/"test"
if not datapath.exists():
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:
data.toFile(datapath,dfb_Opt["suffix"])

View File

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