10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 03:07:44 +02:00

Apply titou format

This commit is contained in:
Mickaël Véril 2019-09-19 15:05:07 +02:00
parent 50bb65cbe8
commit 74e2936f61
3 changed files with 147 additions and 64 deletions

View File

@ -38,35 +38,50 @@ draft: false
par.innerHTML='';
var md=[];
var els=[];
md.push(["Title",dat.title]);
md.push(["Code",dat.code]);
md.push(["ZPE geometry",dat.ZPE])
md.push(["Method",dat.method])
md.push(["Basis",dat.basis]);
md.push(["Molecule",dat.molecule]);
md.push(["Comment",dat.comment])
var dict = {
"Ground state": dat.GS,
"exited states": dat.ES,
};
for (var key in dict){
md.push(key)
md.push(["Code",dict[key].code])
md.push(["Method",dict[key].method])
md.push(["Geometry",dict[key].geometry])
}
md.push("ZPE")
md.push(["Code",dat.ZPE.code])
md.push(["Method",dat.ZPE.method])
md.push(["DOI",dat.doi]);
div=document.getElementById("meta_div")
md.forEach(function(element){
var node = document.createElement("div");
node.innerText= element[0]+': '+element[1];
par.appendChild(node);
var node =null;
if(typeof element==="string"){
node= document.createElement("h2");
node.innerText=element;
} else {
node = document.createElement("div");
node.innerText= element[0]+': '+element[1];
}
div.appendChild(node);
});
var exDiv= document.createElement("div");
par.appendChild(exDiv);
var exTitle = document.createElement("h2");
exTitle.innerText= "Excitations";
exDiv.appendChild(exTitle);
var exPar= document.createElement("p");
exDiv.appendChild(exPar);
await dat.excitations.reduce(async (promise,el)=> {
await promise;
var node = document.createElement("div");
node.innerHTML= String.raw`${LatexInline[0]} ${el.start.toLaTeX()} \rightarrow ${el.end.toLaTeX()}${LatexInline[1]}, ${LatexInline[0]}${el.Eabs.toPrecision(3)}\:\mathrm{eV}${LatexInline[1]}`;
node.hidden=true
exPar.appendChild(node);
await MathJax.typesetPromise();
node.hidden=false;
var t=document.getElementById("ex_table")
dat.excitations.forEach(el=> {
var row=document.createElement("tr")
var rowd=[]
rowd.push(String.raw`${LatexInline[0]} ${el.start.toLaTeX()} \rightarrow ${el.end.toLaTeX()}${LatexInline[1]}`)
var e=[el.Eabs,el.Efluo,el.EZPE,el.Ezz]
e.forEach((val)=>rowd.push(val.toFixed(2)))
rowd.forEach((d)=>{
td=document.createElement("td")
td.innerText=d
row.appendChild(td)
})
t.appendChild(row)
});
await MathJax.typesetPromise();
document.getElementById("ex_div").hidden=false
var lnkdoi = document.createElement("a");
// Wait for the value of publi when required
let publi=await publiPromise;
@ -93,5 +108,19 @@ draft: false
</select>
</label><br/>
<h1>Data</h1>
<p id=data_par></p>
<p id=data_par>
<div id="meta_div"></div>
<div id="ex_div" hidden=true>
<h2>exitation</h2>
<table id="ex_table">
<tr>
<th>Transition</th>
<th>\(E_{abs}\)</th>
<th>\(E_{fluo}\)</th>
<th>\(\Delta E_{ZPE}\)</th>
<th>\(E_{00}\)</th>
</tr>
</table>
</div>
</p>
<a target="_blank" id='lnk_file'>Go to file</a>

View File

@ -0,0 +1,21 @@
# Molecule : Water
# Comment : 0-0 energies of the water molecule
# GS_code : Dalton
# GS_method : CC3,aug-cc-pVDZ
# GS_geom : CC3,aug-cc-pVTZ
# ES_code : Molpro
# ES_method : CCSD,aug-cc-pVQZ
# ES_geom : CC2,cc-pVDZ
# ZPE_code : Gaussian16
# ZPE_method : B3LYP,6-31+G*
# DOI : 10.1021/acs.jctc.8b00406
# Initial state Final state Energies (eV)
####################### ####################### #######################
# Spin Number Symm Spin Number Symm E_abs E_fluo E_zpe
1 1 A_1 1 1 B_1 7.51 0.23 0.01
1 1 A_1 1 1 A_2 9.29 4.23 -0.02
1 1 A_1 1 2 A_1 9.92 8.38 -0.03
1 1 A_1 1 3 B_1 7.13
1 1 A_1 3 1 A_2 9.12
1 1 A_1 3 1 A_1 9.47

View File

@ -10,12 +10,24 @@ class code {
}
return str;
}
static fromString(str) {
var vals=str.split(",")
if(vals.length>=2){
return new code(vals[0],vals[1]);
} else {
return new code(vals[0],null);
}
}
}
class method {
constructor(name,basis){
this.name=name;
this.basis=basis;
}
static fromString(str) {
var vals=str.split(",")
return new method(vals[0],vals[1]);
}
toString() {
var str=this.name;
if (this.name) {
@ -24,22 +36,12 @@ class method {
return str;
}
}
class geometry {
constructor(symetry,method){
this.symetry=method
this.symetry=method
}
toString(){
return String.raw `${this.symetry}-${this.method}`
}
}
class state{
constructor(number,multiplicity,symetry,geometry){
constructor(number,multiplicity,symetry){
this.number=number;
this.multiplicity=multiplicity;
this.symetry=symetry;
this.geometry=geometry
};
toString() {
var str=this.number+ ' ^'+this.multiplicity+this.symetry;
@ -62,22 +64,41 @@ class doi{
};
}
class excitation{
constructor(start,end,Eabs){
constructor(start,end,Eabs,Efluo,EZPE){
this.start=start;
this.end=end;
this.Eabs=Eabs;
this.Efluo=Efluo;
this.EZPE=EZPE;
}
get Ezz() {
return this.Eabs-this.Efluo+this.EZPE
}
toString() {
return this.start+ ', ' + this.end +', '+ this.Eabs.toPrecision(3);
}
}
class CalcParams {
constructor(){
this.code=null;
this.method=null;
}
}
class StateCalcParams extends CalcParams {
constructor(){
super()
this.geometry;
}
}
class data {
constructor(){
this.title='';
this.code=null;
this.ZPE=null;
this.method=null;
this.molecule='';
this.comment;
this.GS=new StateCalcParams();
this.ES=new StateCalcParams();
this.ZPE=new CalcParams();
this.doi=null;
this.excitations=[];
}
@ -88,7 +109,7 @@ class data {
// for each line with metadata
var ismetaArea=true;
//metadata RegExp (start with #; maybe somme spaces; : ; maybe somme space; datas)
var meta=/^#\s*([A-Za-z]+)\s*:\s*(.*)$/;
var meta=/^#\s*([A-Za-z_]+)\s*:\s*(.*)$/;
var dat=new data();
function readmeta(line){
// get key value
@ -99,24 +120,35 @@ class data {
if(match.length==3 && match[2]) {
var val=match[2];
switch(key) {
case "title":
dat.title=val;
case "molecule":
dat.molecule=val
break;
case "code":
var vals=val.split(",")
if(vals.length>=2){
dat.code=new code(vals[0],vals[1]);
} else {
dat.code=new code(vals[0],null);
}
case "comment":
dat.comment=val
break;
case "method":
var vals=val.split(",")
dat.method=new method(vals[0],vals[1]);
case "gs_code":
dat.GS.code=code.fromString(val)
break;
case "zpe":
var vals=val.split(",")
dat.ZPE=new method(vals[0],vals[1]);
case "gs_method":
dat.GS.method=method.fromString(val)
break;
case "gs_geom":
dat.GS.geometry=method.fromString(val)
break;
case "es_code":
dat.ES.code=code.fromString(val)
break
case "es_method":
dat.ES.method=method.fromString(val)
break;
case "es_geom":
dat.ES.geometry=method.fromString(val)
break;
case "zpe_code":
dat.ZPE.code=code.fromString(val)
break
case "zpe_method":
dat.ZPE.method=method.fromString(val)
break;
case "doi":
dat.doi=new doi(val);
@ -125,12 +157,13 @@ class data {
}
}
function readrow(line){
var vals=line.split(/\s+/);
var geom=vals[3].split(",")
var start=new state(parseInt(vals[0],10),parseInt(vals[1],10),vals[2], new geometry(geom[0],new method(geom[1],geom[2])));
geom=vals[7].split(",")
var end=new state(parseInt(vals[4],10),vals[5],vals[6], new geometry(geom[0],new method(geom[1],geom[2])));
var ex=new excitation(start,end,parseFloat(vals[8],10));
var vals=line.split(/\s+/);
while (vals.length<8){
vals.push(null);
}
var start=new state(parseInt(vals[0],10),parseInt(vals[1],10),vals[2]);
var end=new state(parseInt(vals[3],10),vals[4],vals[5]);
var ex=new excitation(start,end,parseFloat(vals[6],10),parseFloat(vals[7],10),parseFloat(vals[8],10));
dat.excitations.push(ex);
};