mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-12-25 22:03:49 +01:00
Use a new format to separate data
This commit is contained in:
parent
b50de34cb6
commit
cff3f653c7
@ -4,8 +4,10 @@ date: 2019-08-29 09:00
|
|||||||
draft: false
|
draft: false
|
||||||
---
|
---
|
||||||
<script src="/scripts/data.js" type="text/javascript"></script>
|
<script src="/scripts/data.js" type="text/javascript"></script>
|
||||||
|
<script src="/scripts/loadAllData.js" type="text/javascript"></script>
|
||||||
<script src="/scripts/getFullDataPath.js" type="text/javascript"></script>
|
<script src="/scripts/getFullDataPath.js" type="text/javascript"></script>
|
||||||
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
|
<script src="/scripts/getTextFromFile.js" type="text/javascript"></script>
|
||||||
|
<script src="/scripts/trueTypeOf.js" type="text/javascript"></script>
|
||||||
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js" type="text/javascript"></script>
|
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js" type="text/javascript"></script>
|
||||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||||
<script type="text/javascript" id="MathJax-script" async
|
<script type="text/javascript" id="MathJax-script" async
|
||||||
@ -14,15 +16,58 @@ draft: false
|
|||||||
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
|
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
|
||||||
{{< getDataFilesName >}}
|
{{< getDataFilesName >}}
|
||||||
<script>
|
<script>
|
||||||
window.onload=function()
|
window.onload=async function()
|
||||||
{
|
{
|
||||||
fsel=document.getElementById("fileSelect")
|
window.Cite = require('citation-js');
|
||||||
getDataFilesName().forEach(function(element) {
|
window.dats=await loadAllData()
|
||||||
op=document.createElement("option");
|
window.data=new CombinedData()
|
||||||
op.value=element;
|
molecules=new Set(Object.values(window.dats).flat().map((d)=>d.molecule))
|
||||||
op.innerText=element.split('.')[0];
|
molecules.forEach(el=>{
|
||||||
fsel.appendChild(op);
|
op=document.createElement("option")
|
||||||
});
|
op.value=el
|
||||||
|
op.innerText=el
|
||||||
|
document.getElementById("select_mol").appendChild(op)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function select_mol_onchange(event){
|
||||||
|
update_mol(event.target.value)
|
||||||
|
}
|
||||||
|
function select_abs_onchange(event){
|
||||||
|
update_abs(window.dats["abs"][event.target.value])
|
||||||
|
}
|
||||||
|
function select_fluo_onchange(event){
|
||||||
|
update_fluo(window.dats["fluo"][event.target.value])
|
||||||
|
}
|
||||||
|
function select_ZPE_onchange(event){
|
||||||
|
update_ZPE(window.dats["ZPE"][event.target.value])
|
||||||
|
}
|
||||||
|
async function update_mol(molecule){
|
||||||
|
Object.keys(window.dats).forEach((key)=>{
|
||||||
|
var s=document.getElementById(String.raw`select_${key}`)
|
||||||
|
while (s.options[s.options.length-1].value!= "") {
|
||||||
|
s.options.remove(s.options[s.options.length-1])
|
||||||
|
}
|
||||||
|
window.dats[key].forEach(val=>{
|
||||||
|
if(val.molecule==molecule){
|
||||||
|
var op=document.createElement("option")
|
||||||
|
op.value=window.dats[key].indexOf(val)
|
||||||
|
op.innerText=val.method.toString()
|
||||||
|
s.appendChild(op)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
async function update_abs(abs){
|
||||||
|
window.data.Abs=abs
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
async function update_fluo(fluo){
|
||||||
|
window.data.Fluo=fluo
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
async function update_ZPE(ZPE){
|
||||||
|
window.data.ZPE=ZPE
|
||||||
|
reload()
|
||||||
}
|
}
|
||||||
async function update_file(file) {
|
async function update_file(file) {
|
||||||
var lnk_file=document.getElementById('lnk_file');
|
var lnk_file=document.getElementById('lnk_file');
|
||||||
@ -30,50 +75,61 @@ draft: false
|
|||||||
dat= await data.loadAsync(file);
|
dat= await data.loadAsync(file);
|
||||||
await applyData(dat);
|
await applyData(dat);
|
||||||
}
|
}
|
||||||
async function applyData(dat) {
|
async function reload() {
|
||||||
const Cite = require('citation-js');
|
|
||||||
// Start an async task to get publi data
|
|
||||||
let publiPromise = Cite.async(dat.doi.string)
|
|
||||||
const LatexInline=['\\(','\\)']
|
const LatexInline=['\\(','\\)']
|
||||||
var par=document.getElementById("data_par")
|
var par=document.getElementById("data_par")
|
||||||
par.innerHTML='';
|
par.innerHTML='';
|
||||||
var md=[];
|
var md=[];
|
||||||
var els=[];
|
var els=[];
|
||||||
md.push(["Molecule",dat.molecule]);
|
var customRenderingProp=["excitations"]
|
||||||
md.push(["Comment",dat.comment])
|
for (const key of Object.keys(window.data)) {
|
||||||
var dict = {
|
if (window.data[key]!=null){
|
||||||
"Ground state": dat.GS,
|
md.push(key)
|
||||||
"Excited states": dat.ES,
|
for (const prop of Object.keys(window.data[key])) {
|
||||||
};
|
if(!(customRenderingProp.includes(prop)))
|
||||||
for (var key in dict){
|
md.push([prop,window.data[key][prop]])
|
||||||
md.push(key)
|
}
|
||||||
md.push(["Code",dict[key].code])
|
md.push(window.data[key].DOI)
|
||||||
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")
|
div=document.getElementById("meta_div")
|
||||||
div.innerHTML=""
|
div.innerHTML=""
|
||||||
md.forEach(function(element){
|
for (element of md) {
|
||||||
var node =null;
|
var node =null;
|
||||||
if(typeof element==="string"){
|
switch (trueTypeOf(element)) {
|
||||||
node= document.createElement("h2");
|
case "string":
|
||||||
node.innerText=element;
|
node= document.createElement("h2");
|
||||||
} else {
|
node.innerText=element;
|
||||||
node = document.createElement("div");
|
break;
|
||||||
node.innerText= element[0]+': '+element[1];
|
case "doi":
|
||||||
|
var doi=element
|
||||||
|
var publi=await Cite.async(element.string)
|
||||||
|
var output = publi.format('bibliography', {
|
||||||
|
format: 'html',
|
||||||
|
template: 'apa',
|
||||||
|
lang: 'en-US'
|
||||||
|
})
|
||||||
|
node=document.createElement("a")
|
||||||
|
node.innerHTML=output
|
||||||
|
node.target='_blank'
|
||||||
|
node.href=element.url
|
||||||
|
break
|
||||||
|
case "Array":
|
||||||
|
k=element[0]
|
||||||
|
v=element[1]
|
||||||
|
k=k.charAt(0).toUpperCase() + k.slice(1)
|
||||||
|
node = document.createElement("div");
|
||||||
|
node.innerText= k+': '+v;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
div.appendChild(node);
|
div.appendChild(node);
|
||||||
});
|
}
|
||||||
var tb=document.getElementById("ex_table_b");
|
var tb=document.getElementById("ex_table_b");
|
||||||
tb.innerHTML=''
|
tb.innerHTML=''
|
||||||
dat.excitations.forEach(el=> {
|
window.data.excitations.forEach(el=> {
|
||||||
var row=document.createElement("tr")
|
var row=document.createElement("tr")
|
||||||
var rowd=[]
|
var rowd=[]
|
||||||
rowd.push(String.raw`${LatexInline[0]} ${el.start.toLaTeX()} \rightarrow ${el.end.toLaTeX()}${LatexInline[1]}`)
|
rowd.push(String.raw`${LatexInline[0]} ${el.initial.toLaTeX()} \rightarrow ${el.final.toLaTeX()}${LatexInline[1]}`)
|
||||||
var e=[el.Eabs,el.Efluo,el.EZPE,el.Eadia,el.Ezz]
|
var e=[el.Eabs,el.Efluo,el.EZPE,el.Eadia,el.Ezz]
|
||||||
e.forEach((val)=>rowd.push(val.toFixed(2)))
|
e.forEach((val)=>rowd.push(val.toFixed(2)))
|
||||||
rowd.forEach((d)=>{
|
rowd.forEach((d)=>{
|
||||||
@ -90,30 +146,18 @@ draft: false
|
|||||||
y: [],
|
y: [],
|
||||||
type: 'bar'
|
type: 'bar'
|
||||||
}];
|
}];
|
||||||
var expdat= await data.loadAsync("/"+dat.molecule.toLowerCase()+"_exp.dat")
|
var expAbsData= await AbsDataFile.loadAsync("/abs/"+window.data.Abs.molecule.toLowerCase()+"_exp.dat")
|
||||||
var i;
|
var i;
|
||||||
for (i = 0; i < dat.excitations.length; i++) {
|
for (i = 0; i < window.data.excitations.length; i++) {
|
||||||
var ext=dat.excitations[i];
|
var ext=window.data.excitations[i];
|
||||||
var exexp=expdat.excitations[i]
|
var exexp=expAbsData.excitations[i]
|
||||||
plotdat[0].x.push(ext.end.toString())
|
plotdat[0].x.push(ext.final.toString())
|
||||||
plotdat[0].y.push(ext.Eabs-exexp.Eabs)
|
plotdat[0].y.push(ext.Eabs-exexp.value)
|
||||||
}
|
}
|
||||||
await MathJax.typesetPromise();
|
await MathJax.typesetPromise();
|
||||||
var layout={title: "Absorption theory deviation"}
|
var layout={title: "Absorption theory deviation"}
|
||||||
Plotly.newPlot('abs_plot', plotdat,layout);
|
Plotly.newPlot('abs_plot', plotdat,layout);
|
||||||
document.getElementById("graph_div").hidden=false
|
document.getElementById("graph_div").hidden=false
|
||||||
var lnkdoi = document.createElement("a");
|
|
||||||
// Wait for the value of publi when required
|
|
||||||
let publi=await publiPromise;
|
|
||||||
let output = publi.format('bibliography', {
|
|
||||||
format: 'html',
|
|
||||||
template: 'apa',
|
|
||||||
lang: 'en-US'
|
|
||||||
})
|
|
||||||
lnkdoi.innerHTML=output
|
|
||||||
lnkdoi.setAttribute('target','_blank');
|
|
||||||
lnkdoi.setAttribute('href',dat.doi.url);
|
|
||||||
par.appendChild(lnkdoi);
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
@ -121,12 +165,31 @@ draft: false
|
|||||||
update_file(e.target.value);
|
update_file(e.target.value);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<div>
|
||||||
<label>Select a data file name<br/>
|
<label>Select a molecule<br/>
|
||||||
<select id="fileSelect" onchange="onValueChange(event)">
|
<select id="select_mol" onchange="select_mol_onchange(event)">
|
||||||
<option value="" disabled=true selected=true>Select a file</option>
|
<option value="" disabled=true selected=true>Select a molecule</option>
|
||||||
</select>
|
</select>
|
||||||
</label><br/>
|
</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Select an absorption method<br/>
|
||||||
|
<select id="select_abs" onchange="select_abs_onchange(event)">
|
||||||
|
<option value="" disabled=true selected=true>Select an absorption method</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>Select a fluorescence method<br/>
|
||||||
|
<select id="select_fluo" onchange="select_fluo_onchange(event)">
|
||||||
|
<option value="" disabled=true selected=true>Select a fluorescence method</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label>Select a ZPE method<br/>
|
||||||
|
<select id="select_ZPE" onchange="select_ZPE_onchange(event)">
|
||||||
|
<option value="" disabled=true selected=true>Select a ZPE method</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<h1>Data</h1>
|
<h1>Data</h1>
|
||||||
<p id=data_par>
|
<p id=data_par>
|
||||||
<div id="meta_div"></div>
|
<div id="meta_div"></div>
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
<script>
|
<script>
|
||||||
{{- $files := readDir "/static/data" }}
|
{{- $files := readDir "/static/data/abs" }}
|
||||||
{{- $list := slice }}
|
{{- $list := slice }}
|
||||||
function getDataFilesName(){
|
function getAbsFilesName(){
|
||||||
{{- range $files }}
|
{{- range $files }}
|
||||||
{{- $ext := path.Ext .Name}}
|
{{- $ext := path.Ext .Name}}
|
||||||
{{- if eq $ext ".dat" }}
|
{{- if eq $ext ".dat" }}
|
||||||
{{- $list = $list | append .Name }}
|
{{- $list = $list | append (print "abs/" .Name) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
var files=JSON.parse({{ jsonify $list }})
|
||||||
|
return files
|
||||||
|
}
|
||||||
|
{{- $files := readDir "/static/data/fluo" }}
|
||||||
|
{{- $list := slice }}
|
||||||
|
function getFluoFilesName(){
|
||||||
|
{{- range $files }}
|
||||||
|
{{- $ext := path.Ext .Name}}
|
||||||
|
{{- if eq $ext ".dat" }}
|
||||||
|
{{- $list = $list | append (print "fluo/" .Name) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
var files=JSON.parse({{ jsonify $list }})
|
||||||
|
return files
|
||||||
|
}
|
||||||
|
{{- $files := readDir "/static/data/zpe" }}
|
||||||
|
{{- $list := slice }}
|
||||||
|
function getZPEFilesName(){
|
||||||
|
{{- range $files }}
|
||||||
|
{{- $ext := path.Ext .Name}}
|
||||||
|
{{- if eq $ext ".dat" }}
|
||||||
|
{{- $list = $list | append (print "zpe/" .Name )}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
var files=JSON.parse({{ jsonify $list }})
|
var files=JSON.parse({{ jsonify $list }})
|
||||||
|
16
static/data/abs/water_aug-cc-pVDZ.dat
Normal file
16
static/data/abs/water_aug-cc-pVDZ.dat
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Molecule : Water
|
||||||
|
# Comment : Absorption energies of the water molecule
|
||||||
|
# code : Dalton
|
||||||
|
# method : CC3,aug-cc-pVDZ
|
||||||
|
# geom : CC3,aug-cc-pVTZ
|
||||||
|
# DOI : 10.1021/acs.jctc.8b00406
|
||||||
|
|
||||||
|
# Initial state Final state Energies (eV)
|
||||||
|
####################### ####################### ############
|
||||||
|
# Spin Number Symm Spin Number Symm E_abs
|
||||||
|
1 1 A_1 1 1 B_1 7.51
|
||||||
|
1 1 A_1 1 1 A_2 9.29
|
||||||
|
1 1 A_1 1 2 A_1 9.92
|
||||||
|
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
|
@ -1,16 +1,13 @@
|
|||||||
# Molecule : Water
|
# Molecule : Water
|
||||||
# Comment : Water experimental
|
# Comment : Absorption energies of the water molecule from experimental datas
|
||||||
# GS_code : experimental
|
# code : experimental
|
||||||
# GS_method : experimental
|
# method : experimental
|
||||||
# GS_geom : experimental
|
# geom : experimental
|
||||||
# ES_code : experimental
|
# DOI : 10.1021/acs.jctc.8b00406
|
||||||
# ES_method : experimental
|
|
||||||
# ES_geom : experimental
|
|
||||||
# DOI : 10.1021/acs.jctc.8b00406
|
|
||||||
|
|
||||||
# Initial state Final state Energies (eV)
|
# Initial state Final state Energies (eV)
|
||||||
####################### ####################### #######################
|
####################### ####################### ###############
|
||||||
# Spin Number Symm Spin Number Symm E_abs E_fluo E_zpe
|
# Spin Number Symm Spin Number Symm E_abs
|
||||||
1 1 A_1 1 1 B_1 7.41
|
1 1 A_1 1 1 B_1 7.41
|
||||||
1 1 A_1 1 1 A_2 9.20
|
1 1 A_1 1 1 A_2 9.20
|
||||||
1 1 A_1 1 2 A_1 9.67
|
1 1 A_1 1 2 A_1 9.67
|
13
static/data/fluo/water_aug-cc-pVQZ_CCSD.dat
Normal file
13
static/data/fluo/water_aug-cc-pVQZ_CCSD.dat
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Molecule : Water
|
||||||
|
# Comment : 0-0 energies of the water molecule
|
||||||
|
# code : Molpro
|
||||||
|
# method : CCSD,aug-cc-pVQZ
|
||||||
|
# geom : CC2,cc-pVDZ
|
||||||
|
# DOI : 10.1021/acs.jctc.8b00406
|
||||||
|
|
||||||
|
# Initial state Final state Energies (eV)
|
||||||
|
####################### ####################### #############
|
||||||
|
# Spin Number Symm Spin Number Symm E_fluo
|
||||||
|
1 1 A_1 1 1 B_1 0.23
|
||||||
|
1 1 A_1 1 1 A_2 4.23
|
||||||
|
1 1 A_1 1 2 A_1 8.38
|
14
static/data/zpe/water_6-31pGs_B3LYP.dat
Normal file
14
static/data/zpe/water_6-31pGs_B3LYP.dat
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Molecule : Water
|
||||||
|
# Comment : 0-0 energies of the water molecule
|
||||||
|
# code : Gaussian16
|
||||||
|
# GS : CC3,aug-cc-pVTZ
|
||||||
|
# ES : CC2,cc-pVDZ
|
||||||
|
# method : B3LYP,6-31+G*
|
||||||
|
# DOI : 10.1021/acs.jctc.8b00406
|
||||||
|
|
||||||
|
# Initial state Final state Energies (eV)
|
||||||
|
####################### ####################### ###############
|
||||||
|
# Spin Number Symm Spin Number Symm E_zpe
|
||||||
|
1 1 A_1 1 1 B_1 0.01
|
||||||
|
1 1 A_1 1 1 A_2 -0.02
|
||||||
|
1 1 A_1 1 2 A_1 -0.03
|
@ -26,7 +26,12 @@ class method {
|
|||||||
}
|
}
|
||||||
static fromString(str) {
|
static fromString(str) {
|
||||||
var vals=str.split(",")
|
var vals=str.split(",")
|
||||||
return new method(vals[0],vals[1]);
|
if(vals.length==2){
|
||||||
|
return new method(vals[0],vals[1]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return new method(vals[0],null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
toString() {
|
toString() {
|
||||||
var str=this.name;
|
var str=this.name;
|
||||||
@ -63,13 +68,26 @@ class doi{
|
|||||||
return 'https://doi.org/'+this.string;
|
return 'https://doi.org/'+this.string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
class excitation{
|
|
||||||
constructor(start,end,Eabs,Efluo,EZPE){
|
class excitationBase{
|
||||||
this.start=start;
|
constructor(initial,final){
|
||||||
this.end=end;
|
this.initial=initial;
|
||||||
this.Eabs=Eabs;
|
this.final=final
|
||||||
this.Efluo=Efluo;
|
}
|
||||||
this.EZPE=EZPE;
|
}
|
||||||
|
class excitationValue extends excitationBase{
|
||||||
|
constructor(initial,final,value){
|
||||||
|
super(initial,final)
|
||||||
|
this.value=value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class excitation extends excitationBase{
|
||||||
|
constructor(initial,final,Eabs,Efluo,EZPE){
|
||||||
|
super(initial,final)
|
||||||
|
this.Eabs=Eabs
|
||||||
|
this.Efluo=Efluo
|
||||||
|
this.EZPE=EZPE
|
||||||
}
|
}
|
||||||
get Eadia() {
|
get Eadia() {
|
||||||
return (this.Eabs+this.Efluo)/2
|
return (this.Eabs+this.Efluo)/2
|
||||||
@ -82,81 +100,54 @@ class excitation{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CalcParams {
|
class dataFileBase {
|
||||||
constructor(){
|
constructor(){
|
||||||
this.code=null;
|
this.molecule=''
|
||||||
this.method=null;
|
this.comment=null
|
||||||
}
|
this.code=null
|
||||||
}
|
this.method=null
|
||||||
class StateCalcParams extends CalcParams {
|
this.excitations=[]
|
||||||
constructor(){
|
this.DOI=null
|
||||||
super()
|
|
||||||
this.geometry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class data {
|
|
||||||
constructor(){
|
|
||||||
this.molecule='';
|
|
||||||
this.comment;
|
|
||||||
this.GS=new StateCalcParams();
|
|
||||||
this.ES=new StateCalcParams();
|
|
||||||
this.ZPE=new CalcParams();
|
|
||||||
this.doi=null;
|
|
||||||
this.excitations=[];
|
|
||||||
}
|
}
|
||||||
static async loadAsync(file) {
|
static async loadAsync(file) {
|
||||||
return data.loadString(await getTextFromFileAsync(getFullDataPath(file)));
|
return this.loadString(await getTextFromFileAsync(getFullDataPath(file)));
|
||||||
|
}
|
||||||
|
static readmetaPair(key, value,dat){
|
||||||
|
switch(key) {
|
||||||
|
case "molecule":
|
||||||
|
dat.molecule=value
|
||||||
|
break;
|
||||||
|
case "comment":
|
||||||
|
dat.comment=value
|
||||||
|
break;
|
||||||
|
case "code":
|
||||||
|
dat.code=code.fromString(value)
|
||||||
|
break;
|
||||||
|
case "method":
|
||||||
|
dat.method=method.fromString(value)
|
||||||
|
break;
|
||||||
|
case "doi":
|
||||||
|
dat.DOI=new doi(value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static loadString(text) {
|
static loadString(text) {
|
||||||
// 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 classname=this.name
|
||||||
|
var dat=eval(String.raw`new ${this.name}()`)
|
||||||
function readmeta(line){
|
function readmeta(line){
|
||||||
// get key value
|
// get key value
|
||||||
var match=line.match(meta);
|
var match=line.match(meta)
|
||||||
// normalize key to lower
|
// normalize key to lower
|
||||||
var key=match[1].toLowerCase();
|
var key=match[1].toLowerCase()
|
||||||
//if data has value
|
//if data has value
|
||||||
if(match.length==3 && match[2]) {
|
if(match.length==3 && match[2]) {
|
||||||
var val=match[2];
|
var val=match[2]
|
||||||
switch(key) {
|
eval(String.raw`${classname}.readmetaPair(key,val,dat)`)
|
||||||
case "molecule":
|
|
||||||
dat.molecule=val
|
|
||||||
break;
|
|
||||||
case "comment":
|
|
||||||
dat.comment=val
|
|
||||||
break;
|
|
||||||
case "gs_code":
|
|
||||||
dat.GS.code=code.fromString(val)
|
|
||||||
break;
|
|
||||||
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);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function readrow(line){
|
function readrow(line){
|
||||||
@ -164,9 +155,10 @@ class data {
|
|||||||
while (vals.length<8){
|
while (vals.length<8){
|
||||||
vals.push(null);
|
vals.push(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
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),vals[4],vals[5]);
|
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));
|
var ex= new excitationValue(start,end,parseFloat(vals[6],10));
|
||||||
dat.excitations.push(ex);
|
dat.excitations.push(ex);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -189,3 +181,106 @@ class data {
|
|||||||
return dat
|
return dat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class oneStateDataFile extends dataFileBase {
|
||||||
|
constructor(){
|
||||||
|
super()
|
||||||
|
this.geometry=null
|
||||||
|
}
|
||||||
|
static readmetaPair(key,value,dat)
|
||||||
|
{
|
||||||
|
if(key=="geom")
|
||||||
|
{
|
||||||
|
dat.geometry=method.fromString(value)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
dataFileBase.readmetaPair(key,value,dat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class AbsDataFile extends oneStateDataFile {
|
||||||
|
|
||||||
|
}
|
||||||
|
class FluoDataFile extends oneStateDataFile {
|
||||||
|
|
||||||
|
}
|
||||||
|
class twoStateDataFileBase extends dataFileBase{
|
||||||
|
constructor(){
|
||||||
|
super()
|
||||||
|
this.GS=null
|
||||||
|
this.ES=null
|
||||||
|
}
|
||||||
|
static readmetaPair(key,value,dat){
|
||||||
|
switch(key) {
|
||||||
|
case "gs":
|
||||||
|
dat.GS=method.fromString(value)
|
||||||
|
break;
|
||||||
|
case "es":
|
||||||
|
dat.ES=method.fromString(value)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dataFileBase.readmetaPair(key,value,dat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class ZPEDataFile extends twoStateDataFileBase {
|
||||||
|
|
||||||
|
}
|
||||||
|
class CombinedData{
|
||||||
|
constructor(){
|
||||||
|
this.Abs=null
|
||||||
|
this.Fluo=null
|
||||||
|
this.ZPE=null
|
||||||
|
}
|
||||||
|
get excitations() {
|
||||||
|
var exs=[]
|
||||||
|
var dic=new Map()
|
||||||
|
if(this.Abs!=null){
|
||||||
|
this.Abs.excitations.forEach((el)=>{
|
||||||
|
var key=JSON.stringify([el.initial,el.final])
|
||||||
|
if(!dic.has(key)){
|
||||||
|
dic.set(key,{})
|
||||||
|
}
|
||||||
|
dic.get(key)["abs"]=el.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(this.Fluo!=null){
|
||||||
|
this.Fluo.excitations.forEach((el)=>{
|
||||||
|
var key=JSON.stringify([el.initial,el.final])
|
||||||
|
if(!dic.has(key)){
|
||||||
|
dic.set(key,{})
|
||||||
|
}
|
||||||
|
dic.get(key)["fluo"]=el.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if(this.ZPE!=null){
|
||||||
|
this.ZPE.excitations.forEach((el)=>{
|
||||||
|
var key=JSON.stringify([el.initial,el.final])
|
||||||
|
if(!dic.has(key)){
|
||||||
|
dic.set(key,{})
|
||||||
|
}
|
||||||
|
dic.get(key)["ZPE"]=el.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
dic.forEach((value,key)=>{
|
||||||
|
var eabs=NaN
|
||||||
|
var efluo=NaN
|
||||||
|
var eZPE=NaN
|
||||||
|
var mykey=JSON.parse(key)
|
||||||
|
mykey.forEach(el=>{
|
||||||
|
Reflect.setPrototypeOf(el,state.prototype)
|
||||||
|
})
|
||||||
|
if("abs" in value){
|
||||||
|
eabs=value["abs"]
|
||||||
|
}
|
||||||
|
if("fluo" in value){
|
||||||
|
efluo=value["fluo"]
|
||||||
|
}
|
||||||
|
if("ZPE" in value){
|
||||||
|
eZPE=value["ZPE"]
|
||||||
|
}
|
||||||
|
exs.push(new excitation(mykey[0],mykey[1],eabs,efluo,eZPE))
|
||||||
|
})
|
||||||
|
return exs
|
||||||
|
};
|
||||||
|
}
|
11
static/scripts/loadAllData.js
Normal file
11
static/scripts/loadAllData.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
async function loadAllData() {
|
||||||
|
dic = {
|
||||||
|
abs: [],
|
||||||
|
fluo: [],
|
||||||
|
ZPE: []
|
||||||
|
};
|
||||||
|
dic.abs = await Promise.all(getAbsFilesName().map((f) => AbsDataFile.loadAsync(f)))
|
||||||
|
dic.fluo = await Promise.all(getFluoFilesName().map((f) => FluoDataFile.loadAsync(f)))
|
||||||
|
dic.ZPE = await Promise.all(getZPEFilesName().map((f) => ZPEDataFile.loadAsync(f)));
|
||||||
|
return dic;
|
||||||
|
}
|
7
static/scripts/trueTypeOf.js
Normal file
7
static/scripts/trueTypeOf.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
function trueTypeOf(object){
|
||||||
|
result=typeof object
|
||||||
|
if(result==typeof({})) {
|
||||||
|
result= object.constructor.name
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user