10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 11:17:42 +02:00

Fix indentation

This commit is contained in:
Mickaël Véril 2020-04-14 15:59:05 +02:00
parent dcb59f7bfa
commit 8224f76d4e

View File

@ -77,9 +77,9 @@ draft: false
$("<li/>").text(name).appendTo(vertkindtl) $("<li/>").text(name).appendTo(vertkindtl)
} }
for (const [name, value] of excitationTypes.All) { for (const [name, value] of excitationTypes.All) {
var txt=value.description.string var txt = value.description.string
if (value.description.isLaTeX) { if (value.description.isLaTeX) {
txt=LatexInline[0]+txt+LatexInline[1] txt = LatexInline[0] + txt + LatexInline[1]
} }
$("<li/>").text(txt).appendTo(extl) $("<li/>").text(txt).appendTo(extl)
var cbli = $("<li/>") var cbli = $("<li/>")
@ -108,8 +108,8 @@ draft: false
for (mol of uniq(subdoi.map(d => d.molecule))) { for (mol of uniq(subdoi.map(d => d.molecule))) {
const submol = subdoi.filter(d => d.molecule === mol) const submol = subdoi.filter(d => d.molecule === mol)
const source = submol.find((d) => { const source = submol.find((d) => {
if (d.DOI.string==="10.1021/acs.jctc.8b01205") { if (d.DOI.string === "10.1021/acs.jctc.8b01205") {
return d.method.name==="CASPT2" && d.method.basis==="aug-cc-pVDZ" return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ"
} else { } else {
return d.method.isTBE return d.method.isTBE
} }
@ -192,13 +192,13 @@ draft: false
return $(el).val().includes(getSelectValue(d, el.name)) return $(el).val().includes(getSelectValue(d, el.name))
}) })
}).map((d) => getSelectValue(d, name))) }).map((d) => getSelectValue(d, name)))
const sets = await (async ()=>{ const sets = await (async () => {
if(name === "DOI"){ if (name === "DOI") {
const publis=await getPublis() const publis = await getPublis()
const sets=publis.sets const sets = publis.sets
return sets return sets
} }
else{ else {
return undefined return undefined
} }
})() })()
@ -237,60 +237,60 @@ draft: false
if (!(sdatdic.has(key))) { if (!(sdatdic.has(key))) {
sdatdic.set(key, new Map()) sdatdic.set(key, new Map())
} }
const myT1s=T1ref.get(d.DOI.string).get(d.molecule) const myT1s = T1ref.get(d.DOI.string).get(d.molecule)
for (const exc of d.excitations) { for (const exc of d.excitations) {
var allowT1=false var allowT1 = false
const T1Key=JSON.stringify((exc.initial,exc.final)) const T1Key = JSON.stringify((exc.initial, exc.final))
const T1range=filterParams.T1 const T1range = filterParams.T1
if (T1range.min===0 && T1range.max===100) { if (T1range.min === 0 && T1range.max === 100) {
allowT1=true allowT1 = true
} else if (myT1s.has(T1Key)) { } else if (myT1s.has(T1Key)) {
const T1Val=myT1s.get(T1Key) const T1Val = myT1s.get(T1Key)
if (T1range.min<=T1Val && T1Val<=T1range.max) { if (T1range.min <= T1Val && T1Val <= T1range.max) {
allowT1=true allowT1 = true
} }
} }
const key2 = JSON.stringify([d.molecule, exc.initial, exc.final, exc.cVertExcitationKind]) const key2 = JSON.stringify([d.molecule, exc.initial, exc.final, exc.cVertExcitationKind])
const keydic = sdatdic.get(key) const keydic = sdatdic.get(key)
if ((!exc.isUnsafe || window.filterParams.unsafe) && ((exc.type & window.filterParams.exType) !== 0) && ((exc.VertExcitationKind & window.filterParams.exVertKind) !== 0) && allowT1) { if ((!exc.isUnsafe || window.filterParams.unsafe) && ((exc.type & window.filterParams.exType) !== 0) && ((exc.VertExcitationKind & window.filterParams.exVertKind) !== 0) && allowT1) {
if (!(keydic.has(key2))) { if (!(keydic.has(key2))) {
keydic.set(key2,exc.value) keydic.set(key2, exc.value)
} }
} }
} }
} }
if (combbasis) { if (combbasis) {
var sdatdic2=new Map() var sdatdic2 = new Map()
for (const [strkey, sdat] of sdatdic) { for (const [strkey, sdat] of sdatdic) {
if (refstr===strkey) { if (refstr === strkey) {
sdatdic2.set(strkey,sdatdic.get(strkey)) sdatdic2.set(strkey, sdatdic.get(strkey))
} }
else { else {
const key=JSON.parse(strkey) const key = JSON.parse(strkey)
const newkey=JSON.stringify([key[0].name,key[1]]) const newkey = JSON.stringify([key[0].name, key[1]])
const newkeybasis=JSON.stringify(key[0].basis) const newkeybasis = JSON.stringify(key[0].basis)
if (!sdatdic2.has(newkey)) { if (!sdatdic2.has(newkey)) {
sdatdic2.set(newkey,new Map()) sdatdic2.set(newkey, new Map())
} }
if (!sdatdic2.get(newkey).has(newkeybasis)) { if (!sdatdic2.get(newkey).has(newkeybasis)) {
sdatdic2.get(newkey).set(newkeybasis,new Map()) sdatdic2.get(newkey).set(newkeybasis, new Map())
} }
for (const [strkey2,exval] of sdat) { for (const [strkey2, exval] of sdat) {
sdatdic2.get(newkey).get(newkeybasis).set(strkey2,exval) sdatdic2.get(newkey).get(newkeybasis).set(strkey2, exval)
} }
} }
} }
sdatdic=sdatdic2 sdatdic = sdatdic2
} }
var sdic = new Map() var sdic = new Map()
for (const [key, sdat] of sdatdic) { for (const [key, sdat] of sdatdic) {
if (key!==refstr) { if (key !== refstr) {
if (!(sdic.has(key))) { if (!(sdic.has(key))) {
sdic.set(key, []) sdic.set(key, [])
} }
if (combbasis) { if (combbasis) {
for (const [key2, dic] of sdat) { for (const [key2, dic] of sdat) {
for(const [key3,exval] of dic){ for (const [key3, exval] of dic) {
sdic.get(key).push(exval - ((sdatdic.has(refstr)) ? sdatdic.get(refstr).get(key3) : NaN)) sdic.get(key).push(exval - ((sdatdic.has(refstr)) ? sdatdic.get(refstr).get(key3) : NaN))
} }
} }
@ -306,7 +306,7 @@ draft: false
row = $("<tr/>") row = $("<tr/>")
key = JSON.parse(keystr) key = JSON.parse(keystr)
if (!combbasis) { if (!combbasis) {
Reflect.setPrototypeOf(key[0], method.prototype) Reflect.setPrototypeOf(key[0], method.prototype)
} }
//Reflect.setPrototypeOf(key[1], DOI.prototype) //Reflect.setPrototypeOf(key[1], DOI.prototype)
th = $("<th/>", { scope: "column" }) th = $("<th/>", { scope: "column" })
@ -315,7 +315,7 @@ draft: false
var thdoi = th.clone() var thdoi = th.clone()
var publi = doiCache.get(doi, true) var publi = doiCache.get(doi, true)
const publis = await getPublis() const publis = await getPublis()
const sets=publis.sets const sets = publis.sets
if (sets.has(doi)) { if (sets.has(doi)) {
var str = sets.get(doi) var str = sets.get(doi)
$(thdoi).append(str + " ") $(thdoi).append(str + " ")
@ -327,60 +327,61 @@ draft: false
format: 'html', format: 'html',
lang: 'en-US' lang: 'en-US'
})).appendTo(thdoi) })).appendTo(thdoi)
$(row).append(thdoi) $(row).append(thdoi)
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))
th.clone().text(noNanVals.length).appendTo(row) th.clone().text(noNanVals.length).appendTo(row)
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(noNanFixed(val, 2)).appendTo(row) $("<td/>").text(noNanFixed(val, 2)).appendTo(row)
}
$(stb).append(row)
var box = {
x: noNanVals,
amean: ss.mean(avals).toFixed(3),
name: key[0].toString() + " MAD : " + ss.mean(avals).toPrecision(4),
type: 'box',
boxmean: 'sd'
};
graphdat.push(box)
}
var layout = {
paper_bgcolor: 'rgba(0,0,0,0)',
plot_bgcolor: 'rgba(0,0,0,0)',
gap: 0,
legend: {
traceorder: 'reversed',
},
xaxis: {
title: {
text: 'Energy (eV)',
} }
}, $(stb).append(row)
bgcolor: '#E2E2E2', var box = {
bordercolor: '#FFFFFF', x: noNanVals,
borderwidth: 2, amean: ss.mean(avals).toFixed(3),
// autosize: false, name: key[0].toString() + " MAD : " + ss.mean(avals).toPrecision(4),
width: 850, type: 'box',
height: 500, boxmean: 'sd'
margin: { };
l: 0, graphdat.push(box)
r: 10, }
b: 15, var layout = {
t: 20, paper_bgcolor: 'rgba(0,0,0,0)',
pad: 0, plot_bgcolor: 'rgba(0,0,0,0)',
}, gap: 0,
} legend: {
Plotly.newPlot('graph_div', graphdat, layout); traceorder: 'reversed',
processingIndicator.isActive = false },
xaxis: {
title: {
text: 'Energy (eV)',
}
},
bgcolor: '#E2E2E2',
bordercolor: '#FFFFFF',
borderwidth: 2,
// autosize: false,
width: 850,
height: 500,
margin: {
l: 0,
r: 10,
b: 15,
t: 20,
pad: 0,
},
}
Plotly.newPlot('graph_div', graphdat, layout);
processingIndicator.isActive = false
} }
async function reloadContent() { async function reloadContent() {
window.filterParams = {unsafe:$("#cb_unsafe").prop("checked"), window.filterParams = {
exType:Array.from(Array.from($("#cb_exTypeList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0), unsafe: $("#cb_unsafe").prop("checked"),
exVertKind:Array.from(Array.from($("#cb_exVertKindList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0), exType: Array.from(Array.from($("#cb_exTypeList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0),
T1:{ exVertKind: Array.from(Array.from($("#cb_exVertKindList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0),
min:parseFloat($("#T1min").val()), T1: {
max:parseFloat($("#T1max").val()) min: parseFloat($("#T1min").val()),
} max: parseFloat($("#T1max").val())
}
} }
doiCache.clear() doiCache.clear()
processingIndicator.isActive = true processingIndicator.isActive = true
@ -397,23 +398,23 @@ draft: false
delete (val) delete (val)
}) })
}) })
window.T1ref=new Map() window.T1ref = new Map()
var dois = new Set(window.filtData.map((d) => d.DOI.string)) var dois = new Set(window.filtData.map((d) => d.DOI.string))
var mols = new Set(window.filtData.map((d) => d.molecule)) var mols = new Set(window.filtData.map((d) => d.molecule))
await window.doiCache.addRange(dois) await window.doiCache.addRange(dois)
for (const doi of dois) { for (const doi of dois) {
window.T1ref.set(doi,new Map()) window.T1ref.set(doi, new Map())
for (const mol of mols) { for (const mol of mols) {
window.T1ref.get(doi).set(mol,new Map()) window.T1ref.get(doi).set(mol, new Map())
var TBESortdat=window.dats.filter(d=>d.DOI.string===doi && d.molecule===mol).sort((d1,d2)=>{ var TBESortdat = window.dats.filter(d => d.DOI.string === doi && d.molecule === mol).sort((d1, d2) => {
if (d1.method.isTBE && !d2.method.isTBE) { if (d1.method.isTBE && !d2.method.isTBE) {
return -1 return -1
} else if(!d1.method.isTBE && d2.method.isTBE) { } else if (!d1.method.isTBE && d2.method.isTBE) {
return 1 return 1
} else if (d1.method.isTBE && d2.method.isTBE) { } else if (d1.method.isTBE && d2.method.isTBE) {
if (d1.method.name==="TBE(FC)" && d2.method.name==="TBE") { if (d1.method.name === "TBE(FC)" && d2.method.name === "TBE") {
return -1 return -1
} else if(d1.method.name==="TBE" && d2.method.name==="TBE(FC)") { } else if (d1.method.name === "TBE" && d2.method.name === "TBE(FC)") {
return 1 return 1
} }
else { else {
@ -421,9 +422,9 @@ draft: false
} }
} }
}) })
if (TBESortdat.length>0 && TBESortdat[0].method.isTBE) { if (TBESortdat.length > 0 && TBESortdat[0].method.isTBE) {
for (const exc of TBESortdat[0].excitations) { for (const exc of TBESortdat[0].excitations) {
window.T1ref.get(doi).get(mol).set(JSON.stringify((exc.initial,exc.final)),exc.T1) window.T1ref.get(doi).get(mol).set(JSON.stringify((exc.initial, exc.final)), exc.T1)
} }
} }
} }
@ -442,7 +443,7 @@ draft: false
return -1 return -1
} }
else if (a.isTBE && b.isTBE) { else if (a.isTBE && b.isTBE) {
if (a.basis!=="CBS" && b.basis==="CBS") { if (a.basis !== "CBS" && b.basis === "CBS") {
return -1 return -1
} }
else { else {
@ -469,22 +470,22 @@ draft: false
datadic = new Map() datadic = new Map()
for (const dat of paperdata) { for (const dat of paperdata) {
const key1 = dat.molecule; const key1 = dat.molecule;
const myT1s=T1ref.get(dat.DOI.string).get(dat.molecule) const myT1s = T1ref.get(dat.DOI.string).get(dat.molecule)
if (!datadic.has(key1)) { if (!datadic.has(key1)) {
datadic.set(key1, new Map()) datadic.set(key1, new Map())
} }
const key3 = JSON.stringify(dat.method) const key3 = JSON.stringify(dat.method)
for (const ex of dat.excitations) { for (const ex of dat.excitations) {
Reflect.setPrototypeOf(ex.type, excitationType.prototype) Reflect.setPrototypeOf(ex.type, excitationType.prototype)
var allowT1=false var allowT1 = false
const T1Key=JSON.stringify((ex.initial,ex.final)) const T1Key = JSON.stringify((ex.initial, ex.final))
const T1range=filterParams.T1 const T1range = filterParams.T1
if (T1range.min===0 && T1range.max===100) { if (T1range.min === 0 && T1range.max === 100) {
allowT1=true allowT1 = true
} else if (myT1s.has(T1Key)) { } else if (myT1s.has(T1Key)) {
const T1Val=myT1s.get(T1Key) const T1Val = myT1s.get(T1Key)
if (T1range.min<=T1Val && T1Val<=T1range.max) { if (T1range.min <= T1Val && T1Val <= T1range.max) {
allowT1=true allowT1 = true
} }
} }
if (((window.filterParams.exType & ex.type) !== 0) && ((window.filterParams.exVertKind & ex.VertExcitationKind) !== 0) && allowT1) { if (((window.filterParams.exType & ex.type) !== 0) && ((window.filterParams.exVertKind & ex.VertExcitationKind) !== 0) && allowT1) {
@ -513,8 +514,8 @@ draft: false
if (ex[3].Value == VertExcitationKinds.Fluorescence.Value) { if (ex[3].Value == VertExcitationKinds.Fluorescence.Value) {
Vertkindtext = String.raw`[\mathrm{F}]` Vertkindtext = String.raw`[\mathrm{F}]`
} }
if(ex[2].description.string){ if (ex[2].description.string) {
desctex="("+ex[2].description.string+")" desctex = "(" + ex[2].description.string + ")"
} }
$("<th/>", { scope: "rowgroup" }).text(String.raw`${LatexInline[0]}${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()} ${Vertkindtext} ${desctex} ${LatexInline[1]}`).appendTo(tr) $("<th/>", { scope: "rowgroup" }).text(String.raw`${LatexInline[0]}${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()} ${Vertkindtext} ${desctex} ${LatexInline[1]}`).appendTo(tr)
var entries = Array.from(exdat.entries()) var entries = Array.from(exdat.entries())
@ -545,10 +546,10 @@ draft: false
} }
await reloadRef() await reloadRef()
} }
async function reloadRef(){ async function reloadRef() {
const combbasis = $("#cb_combbasis").is(':checked') const combbasis = $("#cb_combbasis").is(':checked')
$(sel_ref).empty() $(sel_ref).empty()
for (const el of uniq(window.filtData.map(d =>[d.method, d.DOI.string]))) { for (const el of uniq(window.filtData.map(d => [d.method, d.DOI.string]))) {
op = $("<option/>", { op = $("<option/>", {
value: JSON.stringify(el) value: JSON.stringify(el)
}).text(el[0]) }).text(el[0])
@ -604,7 +605,7 @@ draft: false
<ul> <ul>
<li>Choose if you want to combine basis sets in the statistics</li> <li>Choose if you want to combine basis sets in the statistics</li>
<li>Select a reference from <strong>already selected data</strong> (by default first is selected -it's the <abbr <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> title="Theoretical best estimate">TBE</abbr> if present- is already selected)</li>
</ul> </ul>
<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>
@ -678,9 +679,11 @@ draft: false
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>%T1</legend> <legend>%T1</legend>
<input class="range min" airia-label="Minimum value" type="number" id="T1min" step="0.01" onchange="numberRangeChange(event)" min="0" value="0"> <input class="range min" airia-label="Minimum value" type="number" id="T1min" step="0.01"
onchange="numberRangeChange(event)" min="0" value="0">
<span>\(\leq \mathrm{\%T1} \leq\)</span> <span>\(\leq \mathrm{\%T1} \leq\)</span>
<input class="range max" airia-label="Maximum value" type="number" id="T1max" step="0.01" onchange="numberRangeChange(event)" max="100" value="100"> <input class="range max" airia-label="Maximum value" type="number" id="T1max" step="0.01"
onchange="numberRangeChange(event)" max="100" value="100">
</fieldset> </fieldset>
<input type="submit" disabled=true value="Load"></input> <input type="submit" disabled=true value="Load"></input>
</form> </form>