mirror of
https://github.com/LCPQ/QUESTDB_website.git
synced 2024-11-04 13:13:55 +01: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) {
|
||||
var td = $("<td/>")
|
||||
if (trueTypeOf(el) == DOI.name) {
|
||||
var publi = doiCache.get(el.string)
|
||||
var publi = doiCache.get(el.string, true)
|
||||
const sets = await getSets()
|
||||
if (sets.has(el.toString())) {
|
||||
$(td).append(sets.get(el.toString()))
|
||||
@ -250,65 +250,104 @@ draft: false
|
||||
return values.includes(JSON.stringify(d[prop]))
|
||||
})
|
||||
})
|
||||
var dtb = $("#dat_table > tbody");
|
||||
dtb.empty()
|
||||
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])))
|
||||
{
|
||||
await window.doiCache.addRange(window.filt.map((d) => d.DOI.string))
|
||||
for (const el of uniq(window.filt.map(d => [d.code, d.method, d.DOI]))) {
|
||||
op = $("<option/>", {
|
||||
value: JSON.stringify(el)
|
||||
}).text(el[1])
|
||||
if (el[1].name.includes("TBE")) {
|
||||
$(sel_ref).prepend(op)
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$(sel_ref).append(op)
|
||||
}
|
||||
}
|
||||
$(sel_ref).prop("selectedIndex", 0);
|
||||
for (const d of window.filt) {
|
||||
var row = $("<tr/>")
|
||||
var rowd = []
|
||||
const els = [d.molecule, d.code, d.method, d.DOI]
|
||||
var tableels = els.slice()
|
||||
if (d instanceof oneStateDataFileBase) {
|
||||
tableels.splice(2, 0, d.geometry)
|
||||
var data = $("#data")
|
||||
if (window.filt.length > 0) {
|
||||
var sets = await getSets()
|
||||
for (const doi of doiCache.keys()) {
|
||||
paperdata = window.filt.filter((d) => {
|
||||
return d.DOI.string == doi
|
||||
})
|
||||
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) {
|
||||
tableels.splice(2, 0, [d.GS, d.ES])
|
||||
}
|
||||
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 if (a.isTBE && b.isTBE) {
|
||||
if (!a.isCorrected && b.isCorrected) {
|
||||
return -1
|
||||
}
|
||||
else {
|
||||
$(td).text(el)
|
||||
return 1
|
||||
}
|
||||
$(row).append(td)
|
||||
}
|
||||
$(tdtemp).clone().append($("<a/>", {
|
||||
target: "_blank",
|
||||
href: await d.sourceFile.getViewerURL()
|
||||
}).text("Go to file")).appendTo(row)
|
||||
$(dtb).append(row)
|
||||
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])
|
||||
}
|
||||
}
|
||||
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()
|
||||
}
|
||||
@ -333,7 +372,8 @@ draft: false
|
||||
<ul id="AllowList">
|
||||
</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>
|
||||
</ol>
|
||||
</p>
|
||||
@ -375,21 +415,7 @@ draft: false
|
||||
<label for="sel_ref">Reference</label>
|
||||
<select id="sel_ref" onchange="reloadStat()"></select>
|
||||
</form>
|
||||
<section>
|
||||
<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 id="data">
|
||||
</section>
|
||||
<section>
|
||||
<table id="stat_table" class="datatable">
|
||||
|
@ -72,6 +72,12 @@ class method {
|
||||
}
|
||||
return str;
|
||||
}
|
||||
get isTBE(){
|
||||
return /^TBE/.test(this.name)
|
||||
}
|
||||
get isCorrected(){
|
||||
return /corr$/.test(this.name)
|
||||
}
|
||||
}
|
||||
|
||||
class state {
|
||||
@ -102,11 +108,11 @@ class DOI {
|
||||
}
|
||||
|
||||
class excitationBase {
|
||||
constructor(initial, final, type=null, T1=null) {
|
||||
constructor(initial, final, type='', T1=null) {
|
||||
this.initial = initial;
|
||||
this.final = final
|
||||
this.type=0
|
||||
if (type !== null) {
|
||||
this.type=new excitationType(0,type)
|
||||
if (type !== "") {
|
||||
const tys = type.split(";")
|
||||
const arrow = String.raw`\rightarrow`
|
||||
for (const ty of tys) {
|
||||
@ -114,20 +120,20 @@ class excitationBase {
|
||||
const [initialt, finalt] = ty.split(arrow, 2)
|
||||
const initialts = initialt.split(",")
|
||||
if (initialts.length==2||initialts.length==2){
|
||||
this.type = this.type | excitationTypes.Singulet
|
||||
this.type.value = this.type | excitationTypes.Singulet
|
||||
}
|
||||
else{
|
||||
this.type = this.type | excitationTypes.Doublet
|
||||
this.type.value = this.type | excitationTypes.Doublet
|
||||
}
|
||||
const finalts = finalt.split(",").map(x => x.trim())
|
||||
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`)) {
|
||||
this.type = this.type | excitationTypes.PiPis
|
||||
this.type.value = this.type | excitationTypes.PiPis
|
||||
} 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}`)) {
|
||||
this.type = this.type | excitationTypes.VALENCE
|
||||
this.type.value = this.type | excitationTypes.VALENCE
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,12 +178,6 @@ class dataFileBase {
|
||||
this.DOI = null
|
||||
this.sourceFile=null
|
||||
}
|
||||
get isTBE(){
|
||||
return /^TBE/.test(this.method.name)
|
||||
}
|
||||
get isCorrected(){
|
||||
return /corr$/.test(this.method.name)
|
||||
}
|
||||
static async loadAsync(file) {
|
||||
switch (trueTypeOf(file)) {
|
||||
case String.name:
|
||||
@ -243,9 +243,9 @@ class dataFileBase {
|
||||
}
|
||||
}
|
||||
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 T1=((vals.length>=10+hasType) ? parseFloat(vals[9+hasType],10): NaN)
|
||||
var isUnsafe=((vals.length>=11+hasType) ? parseFloat(vals[10+hasType],10): false)
|
||||
var oscilatorForces=((vals.length>=8+hasType) ? parseFloat(vals[7+hasType],10): NaN)
|
||||
var T1=((vals.length>=9+hasType) ? parseFloat(vals[8+hasType],10): NaN)
|
||||
var isUnsafe=((vals.length>=10+hasType) ? vals[9+hasType]===true.toString(): false)
|
||||
var ex = new excitationValue(start, end, type, val,oscilatorForces,T1,isUnsafe);
|
||||
dat.excitations.push(ex);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user