10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 22:03:49 +01: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=''; par.innerHTML='';
var md=[]; var md=[];
var els=[]; var els=[];
md.push(["Title",dat.title]); md.push(["Molecule",dat.molecule]);
md.push(["Code",dat.code]); md.push(["Comment",dat.comment])
md.push(["ZPE geometry",dat.ZPE]) var dict = {
md.push(["Method",dat.method]) "Ground state": dat.GS,
md.push(["Basis",dat.basis]); "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]); md.push(["DOI",dat.doi]);
div=document.getElementById("meta_div")
md.forEach(function(element){ md.forEach(function(element){
var node = document.createElement("div"); 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]; node.innerText= element[0]+': '+element[1];
par.appendChild(node); }
div.appendChild(node);
});
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)
}); });
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(); await MathJax.typesetPromise();
node.hidden=false; document.getElementById("ex_div").hidden=false
});
var lnkdoi = document.createElement("a"); var lnkdoi = document.createElement("a");
// Wait for the value of publi when required // Wait for the value of publi when required
let publi=await publiPromise; let publi=await publiPromise;
@ -93,5 +108,19 @@ draft: false
</select> </select>
</label><br/> </label><br/>
<h1>Data</h1> <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> <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; 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 { class method {
constructor(name,basis){ constructor(name,basis){
this.name=name; this.name=name;
this.basis=basis; this.basis=basis;
} }
static fromString(str) {
var vals=str.split(",")
return new method(vals[0],vals[1]);
}
toString() { toString() {
var str=this.name; var str=this.name;
if (this.name) { if (this.name) {
@ -24,22 +36,12 @@ class method {
return str; return str;
} }
} }
class geometry {
constructor(symetry,method){
this.symetry=method
this.symetry=method
}
toString(){
return String.raw `${this.symetry}-${this.method}`
}
}
class state{ class state{
constructor(number,multiplicity,symetry,geometry){ constructor(number,multiplicity,symetry){
this.number=number; this.number=number;
this.multiplicity=multiplicity; this.multiplicity=multiplicity;
this.symetry=symetry; this.symetry=symetry;
this.geometry=geometry
}; };
toString() { toString() {
var str=this.number+ ' ^'+this.multiplicity+this.symetry; var str=this.number+ ' ^'+this.multiplicity+this.symetry;
@ -62,22 +64,41 @@ class doi{
}; };
} }
class excitation{ class excitation{
constructor(start,end,Eabs){ constructor(start,end,Eabs,Efluo,EZPE){
this.start=start; this.start=start;
this.end=end; this.end=end;
this.Eabs=Eabs; this.Eabs=Eabs;
this.Efluo=Efluo;
this.EZPE=EZPE;
}
get Ezz() {
return this.Eabs-this.Efluo+this.EZPE
} }
toString() { toString() {
return this.start+ ', ' + this.end +', '+ this.Eabs.toPrecision(3); 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 { class data {
constructor(){ constructor(){
this.title=''; this.molecule='';
this.code=null; this.comment;
this.ZPE=null; this.GS=new StateCalcParams();
this.method=null; this.ES=new StateCalcParams();
this.ZPE=new CalcParams();
this.doi=null; this.doi=null;
this.excitations=[]; this.excitations=[];
} }
@ -88,7 +109,7 @@ class data {
// for each line with metadata // for each line with metadata
var ismetaArea=true; var ismetaArea=true;
//metadata RegExp (start with #; maybe somme spaces; : ; maybe somme space; datas) //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(); var dat=new data();
function readmeta(line){ function readmeta(line){
// get key value // get key value
@ -99,24 +120,35 @@ class data {
if(match.length==3 && match[2]) { if(match.length==3 && match[2]) {
var val=match[2]; var val=match[2];
switch(key) { switch(key) {
case "title": case "molecule":
dat.title=val; dat.molecule=val
break; break;
case "code": case "comment":
var vals=val.split(",") dat.comment=val
if(vals.length>=2){
dat.code=new code(vals[0],vals[1]);
} else {
dat.code=new code(vals[0],null);
}
break; break;
case "method": case "gs_code":
var vals=val.split(",") dat.GS.code=code.fromString(val)
dat.method=new method(vals[0],vals[1]);
break; break;
case "zpe": case "gs_method":
var vals=val.split(",") dat.GS.method=method.fromString(val)
dat.ZPE=new method(vals[0],vals[1]); 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; break;
case "doi": case "doi":
dat.doi=new doi(val); dat.doi=new doi(val);
@ -126,11 +158,12 @@ class data {
} }
function readrow(line){ function readrow(line){
var vals=line.split(/\s+/); var vals=line.split(/\s+/);
var geom=vals[3].split(",") while (vals.length<8){
var start=new state(parseInt(vals[0],10),parseInt(vals[1],10),vals[2], new geometry(geom[0],new method(geom[1],geom[2]))); vals.push(null);
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 start=new state(parseInt(vals[0],10),parseInt(vals[1],10),vals[2]);
var ex=new excitation(start,end,parseFloat(vals[8],10)); 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); dat.excitations.push(ex);
}; };