mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-11-04 13:13:55 +01:00
Add TBE corection
This commit is contained in:
parent
934e136e56
commit
0c74be22f4
@ -20,32 +20,23 @@ class code {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class method {
|
class method {
|
||||||
constructor(name, basis=null,TBEcorr=null) {
|
constructor(name, basis=null) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.basis = basis;
|
this.basis = basis;
|
||||||
this.TBEcorr=TBEcorr
|
|
||||||
}
|
}
|
||||||
static fromString(str) {
|
static fromString(str) {
|
||||||
var vals = str.split(",")
|
var vals = str.split(",")
|
||||||
switch (vals.lenght) {
|
if (vals.length == 2) {
|
||||||
case 3:
|
return new method(vals[0], vals[1]);
|
||||||
return new method(vals[0], vals[1],vals[2]);
|
}
|
||||||
break;
|
else {
|
||||||
case 2:
|
return new method(vals[0], null)
|
||||||
return new method(vals[0], vals[1])
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
return new method(vals[0])
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
toString() {
|
toString() {
|
||||||
var str = this.name;
|
var str = this.name;
|
||||||
if (this.basis) {
|
if (this.basis) {
|
||||||
str = str + '/' + this.basis;
|
str = str + '/' + this.basis;
|
||||||
if (this.TBEcorr) {
|
|
||||||
str+=" ("+this.TBEcorr +")"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@ -85,17 +76,10 @@ class excitationBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class excitationValue extends excitationBase {
|
class excitationValue extends excitationBase {
|
||||||
constructor(initial, final, value) {
|
constructor(initial, final, value,Correction) {
|
||||||
super(initial, final)
|
super(initial, final)
|
||||||
this.value = value
|
this.value = value
|
||||||
}
|
this.correction = correction
|
||||||
}
|
|
||||||
|
|
||||||
class excitationValueCorrected extends excitationBase {
|
|
||||||
constructor(initial, final, value) {
|
|
||||||
super(initial, final)
|
|
||||||
this.value = value
|
|
||||||
this.Correction=value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,10 +107,14 @@ class dataFileBase {
|
|||||||
this.comment = null
|
this.comment = null
|
||||||
this.code = null
|
this.code = null
|
||||||
this.method = null
|
this.method = null
|
||||||
|
this.TBEmethod=null
|
||||||
this.excitations = []
|
this.excitations = []
|
||||||
this.DOI = null
|
this.DOI = null
|
||||||
this.sourceFile=null
|
this.sourceFile=null
|
||||||
}
|
}
|
||||||
|
get isTBE(){
|
||||||
|
return this.TBEmethod!==null;
|
||||||
|
}
|
||||||
static async loadAsync(file) {
|
static async loadAsync(file) {
|
||||||
switch (trueTypeOf(file)) {
|
switch (trueTypeOf(file)) {
|
||||||
case String.name:
|
case String.name:
|
||||||
@ -158,6 +146,9 @@ class dataFileBase {
|
|||||||
case "doi":
|
case "doi":
|
||||||
dat.DOI = new DOI(value);
|
dat.DOI = new DOI(value);
|
||||||
break;
|
break;
|
||||||
|
case "tbemethod":
|
||||||
|
dat.TBEmethod=new method.fromString(value)
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,7 +178,9 @@ class dataFileBase {
|
|||||||
|
|
||||||
var start = new state(parseInt(vals[0], 10), parseInt(vals[1], 10), vals[2]);
|
var start = new state(parseInt(vals[0], 10), parseInt(vals[1], 10), vals[2]);
|
||||||
var end = new state(parseInt(vals[3], 10), parseInt(vals[4],10), vals[5]);
|
var end = new state(parseInt(vals[3], 10), parseInt(vals[4],10), vals[5]);
|
||||||
var ex = new excitationValue(start, end, parseFloat(vals[6], 10));
|
val=((vals.length>=5) ? parseFloat(vals[6], 10): NaN)
|
||||||
|
cor=((vals.length>=6) ? parseFloat(vals[7], 10): NaN)
|
||||||
|
var ex = new excitationValue(start, end, val,cor);
|
||||||
dat.excitations.push(ex);
|
dat.excitations.push(ex);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,9 +22,14 @@ class dataFileBase(object):
|
|||||||
self.comment = ''
|
self.comment = ''
|
||||||
self.code = None
|
self.code = None
|
||||||
self.method = None
|
self.method = None
|
||||||
|
self.TBECorrMethod=None
|
||||||
self.excitations = []
|
self.excitations = []
|
||||||
self.DOI = ''
|
self.DOI = ''
|
||||||
|
|
||||||
|
@property
|
||||||
|
def IsTBE():
|
||||||
|
return self.TBECorrMethod is not None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GetFileType():
|
def GetFileType():
|
||||||
pass
|
pass
|
||||||
@ -124,6 +129,8 @@ class dataFileBase(object):
|
|||||||
dic["Comment"]=self.comment
|
dic["Comment"]=self.comment
|
||||||
dic["code"]="" if self.code is None else self.code.toDataString()
|
dic["code"]="" if self.code is None else self.code.toDataString()
|
||||||
dic["method"]="" if self.method is None else self.method.toDataString()
|
dic["method"]="" if self.method is None else self.method.toDataString()
|
||||||
|
if self.TBECorrMethod is not None:
|
||||||
|
dic["TBECorrMethod"]=self.TBECorrMethod.toDataString()
|
||||||
dic["DOI"]="" if self.DOI is None else self.DOI
|
dic["DOI"]="" if self.DOI is None else self.DOI
|
||||||
return dic
|
return dic
|
||||||
|
|
||||||
@ -140,15 +147,14 @@ class dataFileBase(object):
|
|||||||
f.write("""
|
f.write("""
|
||||||
# Initial state Final state Energies (eV)
|
# Initial state Final state Energies (eV)
|
||||||
####################### ####################### ###############
|
####################### ####################### ###############
|
||||||
# Number Spin Symm Number Spin Symm E_{}\n""".format(self.GetFileType().name.lower()))
|
# Number Spin Symm Number Spin Symm E_{} Correction\n""".format(self.GetFileType().name.lower()))
|
||||||
for ex in self.excitations:
|
for ex in self.excitations:
|
||||||
mystr=" {:8s}{:7s}{:10s}{:8s}{:6s}{:13s}{}\n".format(str(ex.initial.number),str(ex.initial.multiplicity),ex.initial.symetry,str(ex.final.number),str(ex.final.multiplicity),ex.final.symetry,str(ex.value))
|
mystr=" {:8s}{:7s}{:10s}{:8s}{:6s}{:13s}{5s}{}\n".format(str(ex.initial.number),str(ex.initial.multiplicity),ex.initial.symetry,str(ex.final.number),str(ex.final.multiplicity),ex.final.symetry,str(ex.value) if ex.value is not None else "_",str(ex.Correction) if ex.Correction is not None else "_")
|
||||||
f.write(mystr)
|
f.write(mystr)
|
||||||
class method:
|
class method:
|
||||||
def __init__(self,name, *args):
|
def __init__(self,name, *args):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.basis=args[0] if len(args)>0 else None
|
self.basis=args[0] if len(args)>0 else None
|
||||||
self.TBECorr=args if len(args)>1 else None
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fromString(string):
|
def fromString(string):
|
||||||
@ -237,6 +243,8 @@ class excitationBase:
|
|||||||
self.final = final
|
self.final = final
|
||||||
|
|
||||||
class excitationValue(excitationBase):
|
class excitationValue(excitationBase):
|
||||||
def __init__(self,initial, final, value):
|
def __init__(self,initial, final, value,*args):
|
||||||
super(excitationValue,self).__init__(initial, final)
|
super(excitationValue,self).__init__(initial, final)
|
||||||
self.value = value
|
self.value = value
|
||||||
|
if len(args)>0:
|
||||||
|
self.Correction=args[0]
|
Loading…
Reference in New Issue
Block a user