2020-07-03 14:51:12 +02:00
|
|
|
from ..formatHandlerBase import formatHandlerBase
|
|
|
|
from ..formatName import formatName
|
2020-07-08 13:21:40 +02:00
|
|
|
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()
|
2020-07-08 13:21:40 +02:00
|
|
|
subtablesRange=getSubtablesRange(table)
|
|
|
|
for myrange in subtablesRange:
|
2020-07-03 14:51:12 +02:00
|
|
|
datacls=dict()
|
2020-07-08 13:21:40 +02:00
|
|
|
mymolecule=str(table[myrange[0],0])
|
2020-07-03 14:51:12 +02:00
|
|
|
initialState=self.TexOps.initialStates[mymolecule]
|
|
|
|
mymethod=(method("TBE(FC)"),method("TBE"))
|
2020-07-08 13:21:40 +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
|