10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-08-26 06:01:49 +02:00

Add javascript side for isUnsafe and implement excitationTypes

This commit is contained in:
Mickaël Véril 2019-12-15 19:32:14 +01:00
parent 5648d76fa4
commit b0c7ca112d
2 changed files with 40 additions and 14 deletions

View File

@ -22,6 +22,19 @@ draft: false
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script>
window.onload = async () => {
const LatexInline = ['\\(', '\\)']
var al=$("#AllowList")
var ef=$("#exitationFilter")
for (const prop of Object.getOwnPropertyNames(excitationTypes)) {
if(!Object.getOwnPropertyNames(URL).includes(prop)){
$("<li/>").text(LatexInline[0]+excitationTypes[prop].LaTeX+LatexInline[1]).appendTo(al)
$('<label />', { 'for': 'cb_'+prop, text:LatexInline[0]+excitationTypes[prop].LaTeX+LatexInline[1]}).appendTo(ef);
$("<input/>",{type:"checkbox",id:"cb_"+prop,value:excitationTypes[prop].Value}).appendTo(ef)
}
}
await MathJax.typesetPromise();
delete(al)
delete(ef)
window.doiCache = new DOICache()
$('#form_dat > fieldset > input[type=radio]').on('change', async function (event) {
processingIndicator.isActive = true
@ -296,6 +309,9 @@ draft: false
<li>Molecule</li>
<li>Method</li>
<li>Publication</li>
<li>Allow:</li>
<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>Now you can see the list of selected data and some statistics about these data</li>
@ -332,6 +348,8 @@ draft: false
</div>
</fieldset>
<input type="submit" disabled=true value="Load"></input>
<div id="exitationFilter">
</div>
</form>
<form id="form_ref">
<label for="sel_ref">Reference</label>

View File

@ -1,10 +1,16 @@
class excitationType {
static get VALENCE(){return 1}
static get RYDBERG(){return 2}
static get PiPis(){return 4}
static get nPis(){return 8}
static get Singulet(){return 16}
static get Doublet(){return 32}
class excitationTypes {
static get VALENCE(){return new excitationType(1,String.raw`\mathrm{V}`)}
static get RYDBERG(){return new excitationType(2,String.raw`\mathrm{R}`)}
static get PiPis(){return new excitationType(4,String.raw`\pi \rightarrow \pi^\star`)}
static get nPis(){return new excitationType(8,String.raw`n \rightarrow \pi^\star`)}
static get Singulet(){return new excitationType(16,"S")}
static get Doublet(){return new excitationType(32,"D")}
}
class excitationType{
constructor(value,laTeX){
this.Value=value;
this.LaTeX=laTeX
}
}
class code {
constructor(name, version) {
@ -90,20 +96,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 | excitationType.Singulet
this.type = this.type | excitationTypes.Singulet
}
else{
this.type = this.type | excitationType.Doublet
this.type = 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 | excitationType.PiPis
this.type = this.type | excitationTypes.PiPis
} else if (initialts.includes(String.raw`\pi`) in initialts && finals.includes(String.raw`\pi^\star`)) {
this.type = this.type | excitationType.PiPis
this.type = this.type | excitationTypes.PiPis
} else if (ty.includes(String.raw`\pi^\star`)) {
this.type = this.type | excitationType.RYDBERG
this.type = this.type | excitationTypes.RYDBERG
} else if (ty.includes(String.raw`\mathrm{V}`)) {
this.type = this.type | excitationType.VALENCE
this.type = this.type | excitationTypes.VALENCE
}
}
}
@ -116,6 +122,7 @@ class excitationValue extends excitationBase {
super(initial, final, type, T1)
this.value = value
this.oscilatorForces = oscilatorForces
this.isUnsafe = false
}
}
@ -225,7 +232,8 @@ class dataFileBase {
var cor=((vals.length>=8+hasType) ? parseFloat(vals[7+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 ex = new excitationValue(start, end, type, val,cor,oscilatorForces,T1);
var isUnsafe=((vals.length>=11+hasType) ? parseFloat(vals[10+hasType],10): false)
var ex = new excitationValue(start, end, type, val,cor,oscilatorForces,T1,isUnsafe);
dat.excitations.push(ex);
};