mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-08-26 14:11:51 +02:00
FIx bugs and add newtable
This commit is contained in:
parent
06ac6fdcfe
commit
2434659c95
@ -173,7 +173,7 @@ 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()))
|
||||||
@ -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")
|
|
||||||
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/>", {
|
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))
|
||||||
|
const sortedMethods = methods.sort((a, b) => {
|
||||||
|
if (a.isTBE && !b.isTBE) {
|
||||||
|
return -1
|
||||||
}
|
}
|
||||||
else if (d instanceof twoStateDataFileBase) {
|
else if (a.isTBE && b.isTBE) {
|
||||||
tableels.splice(2, 0, [d.GS, d.ES])
|
if (!a.isCorrected && b.isCorrected) {
|
||||||
}
|
return -1
|
||||||
tdtemp=$("<td/>")
|
|
||||||
for (const el of tableels) {
|
|
||||||
td=$("<td/>")
|
|
||||||
if (trueTypeOf(el) == DOI.name) {
|
|
||||||
var publi = doiCache.get(el.string)
|
|
||||||
const sets=await getSets()
|
|
||||||
if(sets.has(el.toString())){
|
|
||||||
$(td).append(sets.get(el.toString()))
|
|
||||||
}
|
|
||||||
$("<a/>", {
|
|
||||||
href: el.url,
|
|
||||||
target: "_blank",
|
|
||||||
}).html(publi.format('citation', {
|
|
||||||
format: 'html',
|
|
||||||
lang: 'en-US'
|
|
||||||
})).appendTo(td)
|
|
||||||
}
|
|
||||||
else if(el==null){
|
|
||||||
$(td).text(String.empty)
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(td).text(el)
|
return 1
|
||||||
}
|
}
|
||||||
$(row).append(td)
|
|
||||||
}
|
}
|
||||||
$(tdtemp).clone().append($("<a/>", {
|
else if (!a.isTBE && b.isTBE) {
|
||||||
target: "_blank",
|
return 1
|
||||||
href: await d.sourceFile.getViewerURL()
|
}
|
||||||
}).text("Go to file")).appendTo(row)
|
else {
|
||||||
$(dtb).append(row)
|
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])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const [molecule, moldat] of datadic.entries()) {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await MathJax.typesetPromise()
|
||||||
}
|
}
|
||||||
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