10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-30 16:15:50 +01:00
QUESTDB_website/tools/lib/formats/default/TBEHandler.py

41 lines
1.6 KiB
Python
Raw Normal View History

2020-07-03 14:51:12 +02:00
from ..formatHandlerBase import formatHandlerBase
from ..formatName import formatName
from ...data import dataFileBase,DataType,method,excitationValue,datafileSelector,getSubtablesRange
2020-07-03 14:51:12 +02:00
from ...utils import getValFromCell, checkFloat
@formatName("TBE")
class TBEHandler(formatHandlerBase):
def readFromTable(self,table):
datalist=list()
subtablesRange=getSubtablesRange(table)
for myrange in subtablesRange:
2020-07-03 14:51:12 +02:00
datacls=dict()
mymolecule=str(table[myrange[0],0])
2020-07-03 14:51:12 +02:00
initialState=self.TexOps.initialStates[mymolecule]
2020-09-22 10:41:07 +02:00
mymethod=(method("TBE","aug-cc-pVTZ"),method("TBE(Full)","CBS"))
2020-10-08 18:41:13 +02:00
finsts=dataFileBase.convertState(table[myrange,1],initialState,default=self.TexOps.defaultType,commands=self.Commands)
for index,row in enumerate(table[myrange,]):
2020-07-03 14:51:12 +02:00
oscilatorForces=checkFloat(str(row[2]))
T1 = checkFloat(str(row[3]))
val,unsafe = getValFromCell(row[4])
corr,unsafecorr = getValFromCell(row[7])
finst=finsts[index]
dt=finst[1]
if dt in datacls:
datamtbe = datacls[dt]
else:
cl=datafileSelector(dt)
datamtbe=[]
for met in mymethod:
data=cl()
data.molecule=mymolecule
data.method=met
datamtbe.append(data)
datacls[dt]=datamtbe
vs=[val,corr]
uns=[unsafe,unsafecorr]
for i in range(2):
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)
return datalist