mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-07-23 11:17:42 +02:00
FIx bugs and add newtable
This commit is contained in:
parent
06ac6fdcfe
commit
2434659c95
@ -23,38 +23,38 @@ draft: false
|
|||||||
<script>
|
<script>
|
||||||
window.onload = async () => {
|
window.onload = async () => {
|
||||||
const LatexInline = ['\\(', '\\)']
|
const LatexInline = ['\\(', '\\)']
|
||||||
var al=$("#AllowList")
|
var al = $("#AllowList")
|
||||||
var ef=$("#exitationFilter")
|
var ef = $("#exitationFilter")
|
||||||
for (const [name,value] of excitationTypes.All) {
|
for (const [name, value] of excitationTypes.All) {
|
||||||
var description=null
|
var description = null
|
||||||
switch (Number(value)) {
|
switch (Number(value)) {
|
||||||
case Number(excitationTypes.VALENCE):
|
case Number(excitationTypes.VALENCE):
|
||||||
description=name.toLowerCase()
|
description = name.toLowerCase()
|
||||||
break;
|
break;
|
||||||
case Number(excitationTypes.RYDBERG):
|
case Number(excitationTypes.RYDBERG):
|
||||||
const word=name
|
const word = name
|
||||||
description=word.charAt(0).toUpperCase()+word.substring(1).toLowerCase()
|
description = word.charAt(0).toUpperCase() + word.substring(1).toLowerCase()
|
||||||
break;
|
break;
|
||||||
case Number(excitationTypes.Singulet):
|
case Number(excitationTypes.Singulet):
|
||||||
description=name.toLowerCase()
|
description = name.toLowerCase()
|
||||||
break;
|
break;
|
||||||
case Number(excitationTypes.Doublet):
|
case Number(excitationTypes.Doublet):
|
||||||
description=name.toLowerCase()
|
description = name.toLowerCase()
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
description = null;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
description=null;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
$("<li/>").text(LatexInline[0]+value.LaTeX+LatexInline[1]+(description==null ?'' : ": "+ description)).appendTo(al)
|
$("<li/>").text(LatexInline[0] + value.LaTeX + LatexInline[1] + (description == null ? '' : ": " + description)).appendTo(al)
|
||||||
$('<label />', { 'for': 'cb_'+name, text:LatexInline[0]+value.LaTeX+LatexInline[1]}).appendTo(ef);
|
$('<label />', { 'for': 'cb_' + name, text: LatexInline[0] + value.LaTeX + LatexInline[1] }).appendTo(ef);
|
||||||
$("<input/>",{type:"checkbox",id:"cb_"+name, name:name, value:Number(value)}).appendTo(ef)
|
$("<input/>", { type: "checkbox", id: "cb_" + name, name: name, value: Number(value) }).appendTo(ef)
|
||||||
}
|
}
|
||||||
await MathJax.typesetPromise();
|
await MathJax.typesetPromise();
|
||||||
$("<li/>").text("Unsafe").appendTo(al)
|
$("<li/>").text("Unsafe").appendTo(al)
|
||||||
$('<label/>', { 'for': 'cb_unsafe', text:"Unsafe"}).appendTo(ef);
|
$('<label/>', { 'for': 'cb_unsafe', text: "Unsafe" }).appendTo(ef);
|
||||||
$("<input/>",{type:"checkbox",id:"cb_unsafe",name:"unsafe"}).appendTo(ef)
|
$("<input/>", { type: "checkbox", id: "cb_unsafe", name: "unsafe" }).appendTo(ef)
|
||||||
delete(al)
|
delete (al)
|
||||||
delete(ef)
|
delete (ef)
|
||||||
window.doiCache = new DOICache()
|
window.doiCache = new DOICache()
|
||||||
$('#form_dat > fieldset > input[type=radio]').on('change', async function (event) {
|
$('#form_dat > fieldset > input[type=radio]').on('change', async function (event) {
|
||||||
processingIndicator.isActive = true
|
processingIndicator.isActive = true
|
||||||
@ -114,15 +114,15 @@ draft: false
|
|||||||
})
|
})
|
||||||
$('#form_dat > fieldset > div > select').each(async function () {
|
$('#form_dat > fieldset > div > select').each(async function () {
|
||||||
const vals = uniq(window.dats.map((d) => { return d[$(this).attr("name")] }))
|
const vals = uniq(window.dats.map((d) => { return d[$(this).attr("name")] }))
|
||||||
var sets=await getSets()
|
var sets = await getSets()
|
||||||
for (const val of vals) {
|
for (const val of vals) {
|
||||||
var op=$("<option/>", {
|
var op = $("<option/>", {
|
||||||
value: JSON.stringify(val)
|
value: JSON.stringify(val)
|
||||||
})
|
})
|
||||||
if ($(this).attr("name")=="DOI" && sets.has(val.toString())){
|
if ($(this).attr("name") == "DOI" && sets.has(val.toString())) {
|
||||||
$(op).text(sets.get(val.toString()))
|
$(op).text(sets.get(val.toString()))
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$(op).text(val.toString())
|
$(op).text(val.toString())
|
||||||
}
|
}
|
||||||
op.appendTo(this)
|
op.appendTo(this)
|
||||||
@ -173,9 +173,9 @@ draft: false
|
|||||||
for (const el of key) {
|
for (const el of key) {
|
||||||
var td = $("<td/>")
|
var td = $("<td/>")
|
||||||
if (trueTypeOf(el) == DOI.name) {
|
if (trueTypeOf(el) == DOI.name) {
|
||||||
var publi = doiCache.get(el.string)
|
var publi = doiCache.get(el.string, true)
|
||||||
const sets=await getSets()
|
const sets = await getSets()
|
||||||
if(sets.has(el.toString())){
|
if (sets.has(el.toString())) {
|
||||||
$(td).append(sets.get(el.toString()))
|
$(td).append(sets.get(el.toString()))
|
||||||
}
|
}
|
||||||
$("<a/>", {
|
$("<a/>", {
|
||||||
@ -191,7 +191,7 @@ draft: false
|
|||||||
}
|
}
|
||||||
$(row).append(td)
|
$(row).append(td)
|
||||||
}
|
}
|
||||||
const noNanVals=(vals.every((v)=> Number.isNaN(v)))? vals : (vals.filter((v) => !Number.isNaN(v)))
|
const noNanVals = (vals.every((v) => Number.isNaN(v))) ? vals : (vals.filter((v) => !Number.isNaN(v)))
|
||||||
const avals = noNanVals.map(v => Math.abs(v))
|
const avals = noNanVals.map(v => Math.abs(v))
|
||||||
for (const val of [ss.min(noNanVals), ss.max(noNanVals), ss.mean(noNanVals), ss.mean(avals), ss.median(noNanVals), ss.median(avals), ss.rootMeanSquare(noNanVals), ss.variance(noNanVals), ss.standardDeviation(noNanVals)]) {
|
for (const val of [ss.min(noNanVals), ss.max(noNanVals), ss.mean(noNanVals), ss.mean(avals), ss.median(noNanVals), ss.median(avals), ss.rootMeanSquare(noNanVals), ss.variance(noNanVals), ss.standardDeviation(noNanVals)]) {
|
||||||
$("<td/>").text(noNanPrecision(val, 3)).appendTo(row)
|
$("<td/>").text(noNanPrecision(val, 3)).appendTo(row)
|
||||||
@ -250,65 +250,104 @@ draft: false
|
|||||||
return values.includes(JSON.stringify(d[prop]))
|
return values.includes(JSON.stringify(d[prop]))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
var dtb = $("#dat_table > tbody");
|
await window.doiCache.addRange(window.filt.map((d) => d.DOI.string))
|
||||||
dtb.empty()
|
for (const el of uniq(window.filt.map(d => [d.code, d.method, d.DOI]))) {
|
||||||
sel_ref = $("#sel_ref")
|
op = $("<option/>", {
|
||||||
await doiCache.addRange(window.filt.map((x)=>x.DOI.string))
|
|
||||||
for (const el of uniq(window.filt.map(d=>[d.code,d.method,d.DOI])))
|
|
||||||
{
|
|
||||||
op=$("<option/>", {
|
|
||||||
value: JSON.stringify(el)
|
value: JSON.stringify(el)
|
||||||
}).text(el[1])
|
}).text(el[1])
|
||||||
if(el[1].name.includes("TBE")){
|
if (el[1].name.includes("TBE")) {
|
||||||
$(sel_ref).prepend(op)
|
$(sel_ref).prepend(op)
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$(sel_ref).append(op)
|
$(sel_ref).append(op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(sel_ref).prop("selectedIndex",0);
|
$(sel_ref).prop("selectedIndex", 0);
|
||||||
for (const d of window.filt) {
|
var data = $("#data")
|
||||||
var row = $("<tr/>")
|
if (window.filt.length > 0) {
|
||||||
var rowd = []
|
var sets = await getSets()
|
||||||
const els = [d.molecule, d.code, d.method, d.DOI]
|
for (const doi of doiCache.keys()) {
|
||||||
var tableels = els.slice()
|
paperdata = window.filt.filter((d) => {
|
||||||
if (d instanceof oneStateDataFileBase) {
|
return d.DOI.string == doi
|
||||||
tableels.splice(2, 0, d.geometry)
|
})
|
||||||
}
|
var methods = uniq(paperdata.map(d => d.method))
|
||||||
else if (d instanceof twoStateDataFileBase) {
|
const sortedMethods = methods.sort((a, b) => {
|
||||||
tableels.splice(2, 0, [d.GS, d.ES])
|
if (a.isTBE && !b.isTBE) {
|
||||||
}
|
return -1
|
||||||
tdtemp=$("<td/>")
|
}
|
||||||
for (const el of tableels) {
|
else if (a.isTBE && b.isTBE) {
|
||||||
td=$("<td/>")
|
if (!a.isCorrected && b.isCorrected) {
|
||||||
if (trueTypeOf(el) == DOI.name) {
|
return -1
|
||||||
var publi = doiCache.get(el.string)
|
}
|
||||||
const sets=await getSets()
|
else {
|
||||||
if(sets.has(el.toString())){
|
return 1
|
||||||
$(td).append(sets.get(el.toString()))
|
}
|
||||||
|
}
|
||||||
|
else if (!a.isTBE && b.isTBE) {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var div = $('<div/>').appendTo(data)
|
||||||
|
$("<h1/>").text(sets.get(doi)).appendTo(div)
|
||||||
|
var table = $("<table/>").addClass("datatable").appendTo(div)
|
||||||
|
var head = $("<tr/>")
|
||||||
|
$("<thead/>").append(head).appendTo(table)
|
||||||
|
var tbody = $("<tbody/>").appendTo(table)
|
||||||
|
head.append(["Molecule", "Transition"].map(x => $("<th/>").text(x)))
|
||||||
|
head.append(sortedMethods.map(x => $("<th/>").text(x.toString())))
|
||||||
|
datadic = new Map()
|
||||||
|
for (const dat of paperdata) {
|
||||||
|
const key1 = dat.molecule;
|
||||||
|
if (!datadic.has(key1)) {
|
||||||
|
datadic.set(key1, new Map())
|
||||||
|
}
|
||||||
|
const key3 = JSON.stringify(dat.method)
|
||||||
|
for (const ex of dat.excitations) {
|
||||||
|
const key2 = JSON.stringify([ex.initial, ex.final, ex.type])
|
||||||
|
if (!datadic.get(key1).has(key2)) {
|
||||||
|
datadic.get(key1).set(key2, new Map())
|
||||||
|
}
|
||||||
|
datadic.get(key1).get(key2).set(key3, [ex.value, ex.isUnsafe])
|
||||||
}
|
}
|
||||||
$("<a/>", {
|
|
||||||
href: el.url,
|
|
||||||
target: "_blank",
|
|
||||||
}).html(publi.format('citation', {
|
|
||||||
format: 'html',
|
|
||||||
lang: 'en-US'
|
|
||||||
})).appendTo(td)
|
|
||||||
}
|
}
|
||||||
else if(el==null){
|
for (const [molecule, moldat] of datadic.entries()) {
|
||||||
$(td).text(String.empty)
|
var printmol = true;
|
||||||
|
for (const [jsonex, exdat] of moldat.entries()) {
|
||||||
|
const ex = JSON.parse(jsonex)
|
||||||
|
Reflect.setPrototypeOf(ex[0], state.prototype)
|
||||||
|
Reflect.setPrototypeOf(ex[1], state.prototype)
|
||||||
|
Reflect.setPrototypeOf(ex[2], excitationType.prototype)
|
||||||
|
var tr = $("<tr/>")
|
||||||
|
var tdmol = $("<td/>")
|
||||||
|
if (printmol) {
|
||||||
|
$(tdmol).text(molecule)
|
||||||
|
printmol = false
|
||||||
|
}
|
||||||
|
tr.append(tdmol)
|
||||||
|
$("<td/>").text(String.raw`${LatexInline[0]}${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()} (${ex[2].LaTeX}) ${LatexInline[1]}`).appendTo(tr)
|
||||||
|
var entries = Array.from(exdat.entries())
|
||||||
|
for (const method of sortedMethods) {
|
||||||
|
td = $("<td/>")
|
||||||
|
kv = entries.find(x => {
|
||||||
|
return JSON.stringify(method) == x[0]
|
||||||
|
})
|
||||||
|
if (kv !== undefined) {
|
||||||
|
const [val,unsafe]=kv[1]
|
||||||
|
if (unsafe) {
|
||||||
|
td.append($("<div/>",{title:"unsafe value",style:"float: left"}).text('⚠'))
|
||||||
|
}
|
||||||
|
td.append(val)
|
||||||
|
}
|
||||||
|
tr.append(td)
|
||||||
|
}
|
||||||
|
tbody.append(tr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
$(td).text(el)
|
|
||||||
}
|
|
||||||
$(row).append(td)
|
|
||||||
}
|
}
|
||||||
$(tdtemp).clone().append($("<a/>", {
|
await MathJax.typesetPromise()
|
||||||
target: "_blank",
|
|
||||||
href: await d.sourceFile.getViewerURL()
|
|
||||||
}).text("Go to file")).appendTo(row)
|
|
||||||
$(dtb).append(row)
|
|
||||||
}
|
}
|
||||||
await reloadStat()
|
await reloadStat()
|
||||||
}
|
}
|
||||||
@ -333,7 +372,8 @@ draft: false
|
|||||||
<ul id="AllowList">
|
<ul id="AllowList">
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<li>Select a reference from <strong>already selected data</strong> (by default first is selected -it's the <abbr title="Theoretical best estimate">TBE</abbr> if present- is already selected)</li>
|
<li>Select a reference from <strong>already selected data</strong> (by default first is selected -it's the <abbr
|
||||||
|
title="Theoretical best estimate">TBE</abbr> if present- is already selected)</li>
|
||||||
<li>Now you can see the list of selected data and some statistics about these data</li>
|
<li>Now you can see the list of selected data and some statistics about these data</li>
|
||||||
</ol>
|
</ol>
|
||||||
</p>
|
</p>
|
||||||
@ -375,21 +415,7 @@ draft: false
|
|||||||
<label for="sel_ref">Reference</label>
|
<label for="sel_ref">Reference</label>
|
||||||
<select id="sel_ref" onchange="reloadStat()"></select>
|
<select id="sel_ref" onchange="reloadStat()"></select>
|
||||||
</form>
|
</form>
|
||||||
<section>
|
<section id="data">
|
||||||
<table id="dat_table" class="datatable">
|
|
||||||
<thead>
|
|
||||||
<th>Molecule</th>
|
|
||||||
<th>Code</th>
|
|
||||||
<th id="Geom_th" hidden=true>Geometry</th>
|
|
||||||
<th id="GSGeom_th" hidden=true>Ground state geometry</th>
|
|
||||||
<th id="ESGeom_th" hidden=true>Excited state geometry</th>
|
|
||||||
<th>Method</th>
|
|
||||||
<th>Publication</th>
|
|
||||||
<th>File</th>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<table id="stat_table" class="datatable">
|
<table id="stat_table" class="datatable">
|
||||||
|
@ -72,6 +72,12 @@ class method {
|
|||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
get isTBE(){
|
||||||
|
return /^TBE/.test(this.name)
|
||||||
|
}
|
||||||
|
get isCorrected(){
|
||||||
|
return /corr$/.test(this.name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class state {
|
class state {
|
||||||
@ -102,11 +108,11 @@ class DOI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class excitationBase {
|
class excitationBase {
|
||||||
constructor(initial, final, type=null, T1=null) {
|
constructor(initial, final, type='', T1=null) {
|
||||||
this.initial = initial;
|
this.initial = initial;
|
||||||
this.final = final
|
this.final = final
|
||||||
this.type=0
|
this.type=new excitationType(0,type)
|
||||||
if (type !== null) {
|
if (type !== "") {
|
||||||
const tys = type.split(";")
|
const tys = type.split(";")
|
||||||
const arrow = String.raw`\rightarrow`
|
const arrow = String.raw`\rightarrow`
|
||||||
for (const ty of tys) {
|
for (const ty of tys) {
|
||||||
@ -114,20 +120,20 @@ class excitationBase {
|
|||||||
const [initialt, finalt] = ty.split(arrow, 2)
|
const [initialt, finalt] = ty.split(arrow, 2)
|
||||||
const initialts = initialt.split(",")
|
const initialts = initialt.split(",")
|
||||||
if (initialts.length==2||initialts.length==2){
|
if (initialts.length==2||initialts.length==2){
|
||||||
this.type = this.type | excitationTypes.Singulet
|
this.type.value = this.type | excitationTypes.Singulet
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.type = this.type | excitationTypes.Doublet
|
this.type.value = this.type | excitationTypes.Doublet
|
||||||
}
|
}
|
||||||
const finalts = finalt.split(",").map(x => x.trim())
|
const finalts = finalt.split(",").map(x => x.trim())
|
||||||
if (initialts.includes("n") && finalts.includes(String.raw`\pi^\star`)) {
|
if (initialts.includes("n") && finalts.includes(String.raw`\pi^\star`)) {
|
||||||
this.type = this.type | excitationTypes.PiPis
|
this.type.value = this.type | excitationTypes.PiPis
|
||||||
} else if (initialts.includes(String.raw`\pi`) in initialts && finals.includes(String.raw`\pi^\star`)) {
|
} else if (initialts.includes(String.raw`\pi`) in initialts && finals.includes(String.raw`\pi^\star`)) {
|
||||||
this.type = this.type | excitationTypes.PiPis
|
this.type.value = this.type | excitationTypes.PiPis
|
||||||
} else if (ty.includes(String.raw`\pi^\star`)) {
|
} else if (ty.includes(String.raw`\pi^\star`)) {
|
||||||
this.type = this.type | excitationTypes.RYDBERG
|
this.type.value = this.type | excitationTypes.RYDBERG
|
||||||
} else if (ty.includes(String.raw`\mathrm{V}`)) {
|
} else if (ty.includes(String.raw`\mathrm{V}`)) {
|
||||||
this.type = this.type | excitationTypes.VALENCE
|
this.type.value = this.type | excitationTypes.VALENCE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,12 +178,6 @@ class dataFileBase {
|
|||||||
this.DOI = null
|
this.DOI = null
|
||||||
this.sourceFile=null
|
this.sourceFile=null
|
||||||
}
|
}
|
||||||
get isTBE(){
|
|
||||||
return /^TBE/.test(this.method.name)
|
|
||||||
}
|
|
||||||
get isCorrected(){
|
|
||||||
return /corr$/.test(this.method.name)
|
|
||||||
}
|
|
||||||
static async loadAsync(file) {
|
static async loadAsync(file) {
|
||||||
switch (trueTypeOf(file)) {
|
switch (trueTypeOf(file)) {
|
||||||
case String.name:
|
case String.name:
|
||||||
@ -243,9 +243,9 @@ class dataFileBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var val=((vals.length>=7+hasType) ? parseFloat(vals[6+hasType], 10): NaN)
|
var val=((vals.length>=7+hasType) ? parseFloat(vals[6+hasType], 10): NaN)
|
||||||
var oscilatorForces=((vals.length>=9+hasType) ? parseFloat(vals[8+hasType],10): NaN)
|
var oscilatorForces=((vals.length>=8+hasType) ? parseFloat(vals[7+hasType],10): NaN)
|
||||||
var T1=((vals.length>=10+hasType) ? parseFloat(vals[9+hasType],10): NaN)
|
var T1=((vals.length>=9+hasType) ? parseFloat(vals[8+hasType],10): NaN)
|
||||||
var isUnsafe=((vals.length>=11+hasType) ? parseFloat(vals[10+hasType],10): false)
|
var isUnsafe=((vals.length>=10+hasType) ? vals[9+hasType]===true.toString(): false)
|
||||||
var ex = new excitationValue(start, end, type, val,oscilatorForces,T1,isUnsafe);
|
var ex = new excitationValue(start, end, type, val,oscilatorForces,T1,isUnsafe);
|
||||||
dat.excitations.push(ex);
|
dat.excitations.push(ex);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user