10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +01: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)
}
for (const [name, value] of excitationTypes.All) {
var txt=value.description.string
var txt = value.description.string
if (value.description.isLaTeX) {
txt=LatexInline[0]+txt+LatexInline[1]
txt = LatexInline[0] + txt + LatexInline[1]
}
$("<li/>").text(txt).appendTo(extl)
var cbli = $("<li/>")
@ -108,8 +108,8 @@ draft: false
for (mol of uniq(subdoi.map(d => d.molecule))) {
const submol = subdoi.filter(d => d.molecule === mol)
const source = submol.find((d) => {
if (d.DOI.string==="10.1021/acs.jctc.8b01205") {
return d.method.name==="CASPT2" && d.method.basis==="aug-cc-pVDZ"
if (d.DOI.string === "10.1021/acs.jctc.8b01205") {
return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ"
} else {
return d.method.isTBE
}
@ -192,13 +192,13 @@ draft: false
return $(el).val().includes(getSelectValue(d, el.name))
})
}).map((d) => getSelectValue(d, name)))
const sets = await (async ()=>{
if(name === "DOI"){
const publis=await getPublis()
const sets=publis.sets
const sets = await (async () => {
if (name === "DOI") {
const publis = await getPublis()
const sets = publis.sets
return sets
}
else{
else {
return undefined
}
})()
@ -237,60 +237,60 @@ draft: false
if (!(sdatdic.has(key))) {
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) {
var allowT1=false
const T1Key=JSON.stringify((exc.initial,exc.final))
const T1range=filterParams.T1
if (T1range.min===0 && T1range.max===100) {
allowT1=true
var allowT1 = false
const T1Key = JSON.stringify((exc.initial, exc.final))
const T1range = filterParams.T1
if (T1range.min === 0 && T1range.max === 100) {
allowT1 = true
} else if (myT1s.has(T1Key)) {
const T1Val=myT1s.get(T1Key)
if (T1range.min<=T1Val && T1Val<=T1range.max) {
allowT1=true
const T1Val = myT1s.get(T1Key)
if (T1range.min <= T1Val && T1Val <= T1range.max) {
allowT1 = true
}
}
const key2 = JSON.stringify([d.molecule, exc.initial, exc.final, exc.cVertExcitationKind])
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 (!(keydic.has(key2))) {
keydic.set(key2,exc.value)
keydic.set(key2, exc.value)
}
}
}
}
if (combbasis) {
var sdatdic2=new Map()
for (const [strkey, sdat] of sdatdic) {
if (refstr===strkey) {
sdatdic2.set(strkey,sdatdic.get(strkey))
var sdatdic2 = new Map()
for (const [strkey, sdat] of sdatdic) {
if (refstr === strkey) {
sdatdic2.set(strkey, sdatdic.get(strkey))
}
else {
const key=JSON.parse(strkey)
const newkey=JSON.stringify([key[0].name,key[1]])
const newkeybasis=JSON.stringify(key[0].basis)
const key = JSON.parse(strkey)
const newkey = JSON.stringify([key[0].name, key[1]])
const newkeybasis = JSON.stringify(key[0].basis)
if (!sdatdic2.has(newkey)) {
sdatdic2.set(newkey,new Map())
sdatdic2.set(newkey, new Map())
}
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) {
sdatdic2.get(newkey).get(newkeybasis).set(strkey2,exval)
for (const [strkey2, exval] of sdat) {
sdatdic2.get(newkey).get(newkeybasis).set(strkey2, exval)
}
}
}
sdatdic=sdatdic2
sdatdic = sdatdic2
}
var sdic = new Map()
for (const [key, sdat] of sdatdic) {
if (key!==refstr) {
if (key !== refstr) {
if (!(sdic.has(key))) {
sdic.set(key, [])
}
if (combbasis) {
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))
}
}
@ -306,7 +306,7 @@ draft: false
row = $("<tr/>")
key = JSON.parse(keystr)
if (!combbasis) {
Reflect.setPrototypeOf(key[0], method.prototype)
Reflect.setPrototypeOf(key[0], method.prototype)
}
//Reflect.setPrototypeOf(key[1], DOI.prototype)
th = $("<th/>", { scope: "column" })
@ -315,7 +315,7 @@ draft: false
var thdoi = th.clone()
var publi = doiCache.get(doi, true)
const publis = await getPublis()
const sets=publis.sets
const sets = publis.sets
if (sets.has(doi)) {
var str = sets.get(doi)
$(thdoi).append(str + " ")
@ -327,60 +327,61 @@ draft: false
format: 'html',
lang: 'en-US'
})).appendTo(thdoi)
$(row).append(thdoi)
const noNanVals = (vals.every((v) => Number.isNaN(v))) ? vals : (vals.filter((v) => !Number.isNaN(v)))
const avals = noNanVals.map(v => Math.abs(v))
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)]) {
$("<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)',
$(row).append(thdoi)
const noNanVals = (vals.every((v) => Number.isNaN(v))) ? vals : (vals.filter((v) => !Number.isNaN(v)))
const avals = noNanVals.map(v => Math.abs(v))
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)]) {
$("<td/>").text(noNanFixed(val, 2)).appendTo(row)
}
},
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
$(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)',
}
},
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() {
window.filterParams = {unsafe:$("#cb_unsafe").prop("checked"),
exType:Array.from(Array.from($("#cb_exTypeList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0),
exVertKind:Array.from(Array.from($("#cb_exVertKindList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0),
T1:{
min:parseFloat($("#T1min").val()),
max:parseFloat($("#T1max").val())
}
window.filterParams = {
unsafe: $("#cb_unsafe").prop("checked"),
exType: Array.from(Array.from($("#cb_exTypeList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0),
exVertKind: Array.from(Array.from($("#cb_exVertKindList>li>input[type=checkbox]:checked")).map(el => parseInt(el.value))).reduce((pv, cv) => pv + cv, 0),
T1: {
min: parseFloat($("#T1min").val()),
max: parseFloat($("#T1max").val())
}
}
doiCache.clear()
processingIndicator.isActive = true
@ -397,23 +398,23 @@ draft: false
delete (val)
})
})
window.T1ref=new Map()
window.T1ref = new Map()
var dois = new Set(window.filtData.map((d) => d.DOI.string))
var mols = new Set(window.filtData.map((d) => d.molecule))
await window.doiCache.addRange(dois)
for (const doi of dois) {
window.T1ref.set(doi,new Map())
window.T1ref.set(doi, new Map())
for (const mol of mols) {
window.T1ref.get(doi).set(mol,new Map())
var TBESortdat=window.dats.filter(d=>d.DOI.string===doi && d.molecule===mol).sort((d1,d2)=>{
window.T1ref.get(doi).set(mol, new Map())
var TBESortdat = window.dats.filter(d => d.DOI.string === doi && d.molecule === mol).sort((d1, d2) => {
if (d1.method.isTBE && !d2.method.isTBE) {
return -1
} else if(!d1.method.isTBE && d2.method.isTBE) {
} else if (!d1.method.isTBE && d2.method.isTBE) {
return 1
} 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
} else if(d1.method.name==="TBE" && d2.method.name==="TBE(FC)") {
} else if (d1.method.name === "TBE" && d2.method.name === "TBE(FC)") {
return 1
}
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) {
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
}
else if (a.isTBE && b.isTBE) {
if (a.basis!=="CBS" && b.basis==="CBS") {
if (a.basis !== "CBS" && b.basis === "CBS") {
return -1
}
else {
@ -469,22 +470,22 @@ draft: false
datadic = new Map()
for (const dat of paperdata) {
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)) {
datadic.set(key1, new Map())
}
const key3 = JSON.stringify(dat.method)
for (const ex of dat.excitations) {
Reflect.setPrototypeOf(ex.type, excitationType.prototype)
var allowT1=false
const T1Key=JSON.stringify((ex.initial,ex.final))
const T1range=filterParams.T1
if (T1range.min===0 && T1range.max===100) {
allowT1=true
var allowT1 = false
const T1Key = JSON.stringify((ex.initial, ex.final))
const T1range = filterParams.T1
if (T1range.min === 0 && T1range.max === 100) {
allowT1 = true
} else if (myT1s.has(T1Key)) {
const T1Val=myT1s.get(T1Key)
if (T1range.min<=T1Val && T1Val<=T1range.max) {
allowT1=true
const T1Val = myT1s.get(T1Key)
if (T1range.min <= T1Val && T1Val <= T1range.max) {
allowT1 = true
}
}
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) {
Vertkindtext = String.raw`[\mathrm{F}]`
}
if(ex[2].description.string){
desctex="("+ex[2].description.string+")"
if (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)
var entries = Array.from(exdat.entries())
@ -545,10 +546,10 @@ draft: false
}
await reloadRef()
}
async function reloadRef(){
async function reloadRef() {
const combbasis = $("#cb_combbasis").is(':checked')
$(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/>", {
value: JSON.stringify(el)
}).text(el[0])
@ -604,7 +605,7 @@ draft: false
<ul>
<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
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>
<li>Now you can see the list of selected data and some statistics about these data</li>
</ol>
@ -678,9 +679,11 @@ draft: false
</fieldset>
<fieldset>
<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>
<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>
<input type="submit" disabled=true value="Load"></input>
</form>