10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 13:13:55 +01: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 src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script> <script>
window.onload = async () => { 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() window.doiCache = new DOICache()
$('#form_dat > fieldset > input[type=radio]').on('change', async function (event) { $('#form_dat > fieldset > input[type=radio]').on('change', async function (event) {
processingIndicator.isActive = true processingIndicator.isActive = true
@ -296,6 +309,9 @@ draft: false
<li>Molecule</li> <li>Molecule</li>
<li>Method</li> <li>Method</li>
<li>Publication</li> <li>Publication</li>
<li>Allow:</li>
<ul id="AllowList">
</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>
@ -332,6 +348,8 @@ draft: false
</div> </div>
</fieldset> </fieldset>
<input type="submit" disabled=true value="Load"></input> <input type="submit" disabled=true value="Load"></input>
<div id="exitationFilter">
</div>
</form> </form>
<form id="form_ref"> <form id="form_ref">
<label for="sel_ref">Reference</label> <label for="sel_ref">Reference</label>

View File

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