1$( document ).ready(function() { 2 3//---------------------------------------------------------------------------------------------------------------------------// 4// GLOBAL VARIABLE DECLARATIONS /////////////////////////////////////////////////////////////////// 5//---------------------------------------------------------------------------------------------------------------------------// 6 var projectiles = { 7 el : 'electron', 8 pos : 'positron', 9 prot : 'proton' 10 }; 11 var elTargets = { 12 H2 : { H2: 'H2', D2: 'D2', T2: 'T2', HD: 'HD', HT: 'HT', DT: 'DT' }, 13 H2plus : { H2plus: 'H2+', D2plus: 'D2+', T2plus: 'T2+', HDplus: 'HD+', HTplus: 'HT+', DTplus: 'DT+' }, 14 HeHplus : { '4HeHplus': '4HeH+' }, 15 LiH : { '7LiH': '7LiH' }, 16 Li2 : { '7Li2': '7Li2' } 17 }; 18 var posTargets = { 19 H2 : { H2: 'H2' }, 20 H2plus : { H2plus: 'H2+' } 21 }; 22 var protTargets = { 23 H2 : { H2: 'H2' }, 24 }; 25 var targets = { el : elTargets, pos : posTargets, prot : protTargets }; 26 var scatteringSystem = { projectile : "", targetEl : "", target : "", targetLabel : "" }; 27 var labels = { 28 All : 'All', 29 X1Sg : "<i>X</i> <sup>1</sup>Σ<sub>g</sub><sup>+</sup>", 30 B1Su : "<i>B</i> <sup>1</sup>Σ<sub>u</sub><sup>+</sup>", 31 EF1Sg : "<i>EF</i> <sup>1</sup>Σ<sub>g</sub><sup>+</sup>", 32 C1Pu : "<i>C</i> <sup>1</sup>Π<sub>u</sub>", 33 Bp1Su : "<i>B'</i> <sup>1</sup>Σ<sub>u</sub><sup>+</sup>", 34 Bpp1Su : "<i>B''</i> <sup>1</sup>Σ<sub>u</sub><sup>+</sup>", 35 GK1Sg : "<i>GK</i> <sup>1</sup>Σ<sub>g</sub><sup>+</sup>", 36 I1Pg : "<i>I</i> <sup>1</sup>Π<sub>g</sub>", 37 J1Dg : "<i>J</i> <sup>1</sup>Δ<sub>g</sub>", 38 H1Sg : "<i>H</i> <sup>1</sup>Σ<sub>g</sub><sup>+</sup>", 39 D1Pu : "<i>D</i> <sup>1</sup>Π<sub>u</sub>", 40 Dp1Pu : "<i>D'</i> <sup>1</sup>Π<sub>u</sub>", 41 b3Su : "<i>b</i> <sup>3</sup>Σ<sub>u</sub><sup>+</sup>", 42 a3Sg : "<i>a</i> <sup>3</sup>Σ<sub>g</sub><sup>+</sup>", 43 c3Pu : "<i>c</i> <sup>3</sup>Π<sub>u</sub>", 44 e3Su : "<i>e</i> <sup>3</sup>Σ<sub>u</sub><sup>+</sup>", 45 h3Sg : "<i>h</i> <sup>3</sup>Σ<sub>g</sub><sup>+</sup>", 46 d3Pu : "<i>d</i> <sup>3</sup>Π<sub>u</sub>", 47 g3Sg : "<i>g</i> <sup>3</sup>Σ<sub>g</sub><sup>+</sup>", 48 i3Pg : "<i>i</i> <sup>3</sup>Π<sub>g</sub>", 49 j3Dg : "<i>j</i> <sup>3</sup>Δ<sub>g</sub>", 50 '1sSg' : "1sσ<sub>g</sub>", 51 '2pSu' : "2pσ<sub>u</sub>", 52 '2pPu' : "2pπ<sub>u</sub>", 53 X1S : "<i>X</i> <sup>1</sup>Σ<sup>+</sup>", 54 A1S : "<i>A</i> <sup>1</sup>Σ<sup>+</sup>", 55 B1S : "<i>B</i> <sup>1</sup>Σ<sup>+</sup>", 56 C1P : "<i>C</i> <sup>1</sup>Π", 57 D1S : "<i>D</i> <sup>1</sup>Σ<sup>+</sup>", 58 E1S : "<i>E</i> <sup>1</sup>Σ<sup>+</sup>", 59 F1P : "<i>F</i> <sup>1</sup>Π", 60 G1S : "<i>G</i> <sup>1</sup>Σ<sup>+</sup>", 61 H1P : "<i>H</i> <sup>1</sup>Π", 62 I1D : "<i>I</i> <sup>1</sup>Δ", 63 a3S : "<i>a</i> <sup>3</sup>Σ<sup>+</sup>", 64 b3S : "<i>b</i> <sup>3</sup>Σ<sup>+</sup>", 65 c3P : "<i>c</i> <sup>3</sup>Π", 66 d3S : "<i>d</i> <sup>3</sup>Σ<sup>+</sup>", 67 e3P : "<i>e</i> <sup>3</sup>Π", 68 f3S : "<i>f</i> <sup>3</sup>Σ<sup>+</sup>", 69 g3S : "<i>g</i> <sup>3</sup>Σ<sup>+</sup>", 70 h3P : "<i>h</i> <sup>3</sup>Π", 71 i3D : "<i>i</i> <sup>3</sup>Δ", 72 B1P : "<i>B</i> <sup>1</sup>Π", 73 C1S : "<i>C</i> <sup>1</sup>Σ<sup>+</sup>", 74 I1P : "<i>I</i> <sup>1</sup>Π", 75 J1P : "<i>J</i> <sup>1</sup>Π", 76 K1D : "<i>K</i> <sup>1</sup>Δ", 77 b3P : "<i>b</i> <sup>3</sup>Π", 78 c3S : "<i>c</i> <sup>3</sup>Σ<sup>+</sup>", 79 e3S : "<i>e</i> <sup>3</sup>Σ<sup>+</sup>", 80 i3P : "<i>i</i> <sup>3</sup>Π", 81 j3P : "<i>j</i> <sup>3</sup>Π", 82 k3D : "<i>k</i> <sup>3</sup>Δ", 83 '1 1Pg' : "1 <sup>1</sup>Π<sub>g</sub>", 84 '1 1Pu' : "1 <sup>1</sup>Π<sub>u</sub>", 85 '1 1Su' : "1 <sup>1</sup>Σ<sub>u</sub>", 86 '1 3Pg' : "1 <sup>3</sup>Π<sub>g</sub>", 87 '1 3Pu' : "1 <sup>3</sup>Π<sub>u</sub>", 88 '1 3Sg' : "1 <sup>3</sup>Σ<sub>g</sub>", 89 '1 3Su' : "1 <sup>3</sup>Σ<sub>u</sub>", 90 '2 1Sg' : "2 <sup>1</sup>Σ<sub>g</sub>", 91 '2 3Sg' : "2 <sup>3</sup>Σ<sub>g</sub>", 92 '3 1Sg' : "3 <sup>1</sup>Σ<sub>g</sub>" 93 }; 94 targetLabels = { 95 H2 : 'H<sub>2</sub>', 96 H2plus : 'H<sub>2</sub><sup>+</sup>', 97 D2 : 'D<sub>2</sub>', 98 D2plus : 'D<sub>2</sub><sup>+</sup>', 99 T2 : 'T<sub>2</sub>', 100 T2plus : 'T<sub>2</sub><sup>+</sup>', 101 HD : 'HD', 102 HDplus : 'HD<sup>+</sup>', 103 DT : 'DT', 104 DTplus : 'DT<sup>+</sup>', 105 HT : 'HT', 106 HTplus : 'HT<sup>+</sup>', 107 HeHplus : 'HeH<sup>+</sup>', 108 '4HeHplus' : '<sup>4</sup>HeH<sup>+</sup>', 109 '7LiH' : '<sup>7</sup>LiH', 110 'LiH' : 'LiH', 111 '7Li2' : '<sup>7</sup>Li<sub>2</sub>', 112 'Li2' : 'Li<sub>2</sub>' 113 }; 114 115 var target = { 116 esti : "", 117 estilabel : "", 118 vsti : "", 119 estf : "", 120 estflabel : "", 121 vstf : "", 122 process : "", 123 nsti : "", 124 nstf : "" 125 }; 126 var targetDownload = { 127 esti : "", 128 estilabel : "", 129 vsti : "", 130 process : "" 131 } 132 var plotSettings = { 133 logx : 'OFF', 134 logy : 'OFF', 135 units : 'au',
136 usersetlogx : 'NO' 137 } 138 var baseFilePath = ''; 139 var plotFilePath = ''; 140 var plotFileName = ''; 141 var fitFilePath = ''; 142 var fitFileName = ''; 143 var referenceText = ''; 144//---------------------------------------------------------------------------------------------------------------------------// 145 146 147//---------------------------------------------------------------------------------------------------------------------------// 148// ON PAGE LOAD / REFRESH 149//---------------------------------------------------------------------------------------------------------------------------// 150 resetSystemCard(); 151 resetDownloadCard(); 152 resetDisplayCard(); 153 updateHelpText(); 154//---------------------------------------------------------------------------------------------------------------------------// 155 156 157//---------------------------------------------------------------------------------------------------------------------------// 158// CARD RESETTING 159//---------------------------------------------------------------------------------------------------------------------------// 160 function resetSystemCard() { 161 $("#resetButtonSystem").attr('disabled',true); 162 $(".systemSelects").empty().append($("<option></option>")).attr('Disabled',true); 163 $("#projectileSelect").attr('Disabled',false); 164 $.each(projectiles, function(key, value) { 165 $("#projectileSelect").append($("<option></option>").val(key).html(value)); 166 }); 167 Object.keys(scatteringSystem).forEach(i => scatteringSystem[i] = ''); 168 Object.keys(target).forEach(i => target[i] = ''); 169 } 170 function resetDisplayCard() { 171 $("#resetButtonDisplay").attr('Disabled',true); 172 $(".displaySelects").empty().append($("<option></option>")).attr('Disabled',true); 173 Object.keys(target).forEach(i => target[i] = ''); 174 if(scatteringSystem.projectile != '' && scatteringSystem.target != '') 175 { 176 populateEsti('Display'); 177 $("#displayCard").removeClass('card-disabled'); 178 } 179 else 180 { 181 $("#estiSelectDisplay").empty().append($("<option></option>")).attr('Disabled',true); 182 $("#displayCard").addClass('card-disabled'); 183 } 184 hideData(); 185 $("#fileView, #fitsView").hide(); 186 $("#plotView").show(); 187 plotSettings.logx = 'OFF'; 188 plotSettings.logy = 'OFF'; 189 plotSettings.usersetlogx = 'NO'; 190 $(".plotMenu-button").removeClass('plotMenu-button-selected').addClass('plotMenu-button-unselected'); 191 $("#plotButton").removeClass('plotMenu-button-unselected').addClass('plotMenu-button-selected'); 192 } 193 function resetDownloadCard() { 194 $(".downloadButtons").attr('Disabled',true); 195 $(".downloadSelects").attr('Disabled',true).empty().append($("<option></option>")); 196 updateHelpText(); 197 Object.keys(targetDownload).forEach(i => targetDownload[i] = ''); 198 if(scatteringSystem.projectile != '' && scatteringSystem.target != '') 199 { 200 populateEsti('Download'); 201 $("#downloadCard").removeClass('card-disabled'); 202 } 203 else 204 { 205 $("#estiSelectDownload").empty().append($("<option></option>")).attr('Disabled',true); 206 $("#downloadCard").addClass('card-disabled'); 207 } 208 } 209 210 $(".systemSelects" ).change( function enableSystemResetButton() { 211 $("#resetButtonSystem").attr('disabled',false); 212 updateHelpText(); 213 } ); 214 $(".displaySelects" ).change( function enableDisplayResetButton() { $("#resetButtonDisplay" ).attr('disabled',false); } ); 215 $(".downloadSelects").change( function enableDownloadResetButton() { $("#resetButtonDownload").attr('disabled',false); } ); 216 217 $("#resetButtonSystem" ).click( function systemResetClicked() { resetSystemCard(); resetDisplayCard(); resetDownloadCard(); } ); 218 $("#resetButtonDisplay" ).click( function displayResetClicked() { resetDisplayCard(); } ); 219 $("#resetButtonDownload").click( function downloadResetClicked() { resetDownloadCard(); } ); 220//---------------------------------------------------------------------------------------------------------------------------// 221 222 223//---------------------------------------------------------------------------------------------------------------------------// 224// SYSTEM SELECTS 225//---------------------------------------------------------------------------------------------------------------------------// 226 $("#projectileSelect").change( function projectileSelectChanged() { 227 scatteringSystem.projectile = $("#projectileSelect").find(":selected").val(); 228 if ( Object.keys(targets[scatteringSystem.projectile]).length === 1 ) 229 { 230 $("#targetElSelect").attr('Disabled',true).empty(); 231 scatteringSystem.targetEl = Object.keys(targets[scatteringSystem.projectile])[0]; 232 targetElSelectChanged(); 233 } 234 else 235 { 236 $("#targetElSelect").attr('Disabled',false).empty().append($("<option></option>")); 237 $("#targetSelect").empty().append($("<option></option>")).attr('Disabled',true); 238 } 239 $.each(targets[scatteringSystem.projectile], function(key, value) { 240 //let label = value[Object.keys(value)[0]]; 241 let label = targetLabels[key]; 242 $("#targetElSelect").append($("<option></option>").val(key).html(label)); 243 }); 244 }); 245 246 $("#targetElSelect").change(function() { 247 scatteringSystem.targetEl = $("#targetElSelect").find(":selected").val(); 248 targetElSelectChanged(); 249 }); 250 function targetElSelectChanged() { 251 console.log('El: '+scatteringSystem.targetEl); 252 console.log(targets[scatteringSystem.projectile]); 253 if ( Object.keys(targets[scatteringSystem.projectile][scatteringSystem.targetEl]).length === 1 ) 254 { 255 $("#targetSelect").attr('Disabled',true).empty(); 256 } 257 else 258 { 259 $("#targetSelect").attr('Disabled',false).empty(); 260 } 261 262 $.each(targets[scatteringSystem.projectile][scatteringSystem.targetEl], function(key, value) { 263 $("#targetSelect").append($("<option></option>").val(key).html('[ '+value+' ]')); 264 }); 265 266 //scatteringSystem.target = scatteringSystem.targetEl; 267 scatteringSystem.target = $("#targetSelect" ).find(":selected").val(); 268 scatteringSystem.targetLabel = targetLabels[scatteringSystem.target]; 269 270 } 271 $("#projectileSelect, #targetElSelect").change( function projectileOrTargetElSelectChanged() { 272 resetDownloadCard(); 273 resetDisplayCard(); 274 }); 275 276 $("#targetSelect").change( function targetChanged() { 277 scatteringSystem.target = $("#targetSelect" ).find(":selected").val(); 278 scatteringSystem.targetLabel = targetLabels[scatteringSystem.target]; 279 console.log('target label: '+scatteringSystem.targetLabel); 280 if(scatteringSystem.projectile != '' && scatteringSystem.target != '') 281 { 282 populateEsti('Display'); 283 populateEsti('Download'); 284 $("#displayCard").removeClass('card-disabled'); 285 $("#downloadCard").removeClass('card-disabled'); 286 if(target.process === 'excitation' || target.process === 'ERD') 287 { 288 populateEstf(); 289 } 290 } 291 }); 292 $(".systemSelects").change( function systemSelectsChanged() { 293 if(scatteringSystem.projectile != '' && scatteringSystem.target != '') 294 { 295 baseFilePath = 'MCCC-' + scatteringSystem.projectile + '-' + scatteringSystem.target; 296 } 297 else 298 { 299 baseFilePath = ''; 300 } 301 }); 302 303//---------------------------------------------------------------------------------------------------------------------------// 304 305 306//---------------------------------------------------------------------------------------------------------------------------// 307// INITIAL STATE SELECTS 308//---------------------------------------------------------------------------------------------------------------------------// 309 $("#estiSelectDisplay").change( function estiSelectDisplayChanged() { 310 target.esti = $("#estiSelectDisplay").find(":selected").val(); 311 target.estilabel = labels[target.esti]; 312 console.log('calling populateVsti'); 313 populateVsti('Display'); 314 }); 315 $("#estiSelectDownload").change( function estiSelectDownloadChanged() { 316 $("#downloadButton").attr("disabled",true); 317 targetDownload.esti = $("#estiSelectDownload").find(":selected").val(); 318 targetDownload.estilabel = labels[target.esti]; 319 populateVsti('Download'); 320 }); 321 322 $("#vstiSelectDisplay").change( function vstiSelectDisplayChanged() { 323 //console.trace(); 324 target.vsti = $("#vstiSelectDisplay").find(":selected").val(); 325 if(target.vsti !== '') 326 { 327 //updateProcesses(); 328 } 329 else 330 { 331 hideData(); 332 } 333 }); 334 335 function populateEsti(card) { 336 //console.trace(); 337 let estiSelect = ''; 338 let vstiSelect = ''; 339 let addALL = ''; 340 let targ = ''; 341 if(scatteringSystem.target !== '' && scatteringSystem.projectile !== '') 342 { 343 estiSelect = $("#estiSelect" + card); 344 vstiSelect = $("#vstiSelect" + card); 345 if(card == 'Download') 346 { 347 addALL = true; 348 targ = targetDownload; 349 } 350 else 351 { 352 addALL = false;
353 targ = target; 354 } 355 $.ajax({ 356 type: 'POST', 357 url: 'cgi-bin/scan_esti.php', 358 data: { proj : scatteringSystem.projectile, target : scatteringSystem.target}, 359 dataType:"json", 360 success: function(response){ 361 populateSelect(estiSelect,response,addALL); 362 if(response.length == 1) 363 { 364 targ.esti = response[0] 365 targ.estilabel = labels[targ.esti]; 366 } 367 }, 368 async: false 369 }); // end AJAX 370 if(targ.esti != '' && Array.from(document.getElementById("estiSelect"+card).options).map(e => e.value).includes(targ.esti)) 371 { 372 $("#estiSelect"+card+" option[value="+targ.esti+"]").attr('selected','selected'); 373 console.log('esti='+targ.esti + ' still available'); 374 } 375 else 376 { 377 targ.esti = ''; 378 } 379 } // end if 380 if(targ.esti != '') populateVsti(card); 381 } // end function populateEsti 382 383 function populateVsti(card) { 384 //console.trace(); 385 vstiSelect = $("#vstiSelect" + card); 386 vstiSelect.attr("disabled",false).empty().append($("<option></option>")); 387 if(card == 'Download') targ = targetDownload; else targ = target; 388 if(targ.esti == '') 389 { 390 vstiSelect.attr("disabled",true); 391 targ.vsti = ''; 392 hideData(); 393 } 394 else if(targ.esti === 'All') 395 { 396 vstiSelect.empty().attr('disabled',true).append($("<option></option>").val('All').html('All')); 397 targ.vsti = 'All'; 398 } 399 else 400 { 401 let numv = getNumvi(targ.esti); 402 console.log(">>> numv:" + numv); 403 if(numv == 1) 404 { 405 vstiSelect.attr('Disabled',true); 406 vstiSelect.empty().append($("<option></option>").val(0).html(0)); 407 targ.vsti = '0'; 408 } 409 else 410 { 411 if(card === 'Download') 412 { 413 vstiSelect.empty().attr('Disabled',false).append($("<option></option>")); 414 vstiSelect.append($("<option></option>").val('All').html('All')); 415 vibInitialiser(vstiSelect, 0, numv, false); 416 } 417 else 418 { 419 vibInitialiser(vstiSelect, 0, numv, true); 420 } 421 if(targ.vsti != '' && Array.from(document.getElementById("vstiSelect"+card).options).map(e => e.value).includes(targ.vsti)) 422 { 423 $("#vstiSelect"+card+" option[value="+targ.vsti+"]").attr('selected','selected'); 424 console.log('vsti='+targ.vsti + ' still available'); 425 } 426 else 427 { 428 targ.vsti = ''; 429 } 430 } 431 } 432 if(targ.vsti != '') updateProcesses(card); 433 } 434 435 function getNumvi(esti) { 436 let numv = -1; 437 let err = -1; 438 console.log("data: " + scatteringSystem.projectile + " " + scatteringSystem.target + " " + esti); 439 $.ajax({ 440 type: 'POST', 441 url: 'cgi-bin/scan_vsti.php', 442 data: { proj : scatteringSystem.projectile, target : scatteringSystem.target, esti : esti}, 443 dataType:"json", 444 success: function(response){ numv = response; }, 445 error: function(response){ err = response; }, 446 async: false 447 }); //end 448 console.log("Response: " + numv); 449 console.log("ResponseErr: " + err); 450 return numv 451 } 452 453 $(".initialStateSelects").change( function initialStateSelectsChanged() { 454 updateProcesses('Display'); 455 }); 456 457 $(".initialStateSelectsDownload").change( function initialStateSelectsDownloadChanged() { 458 targetDownload.vsti = $("#vstiSelectDownload").find(":selected").val(); 459 updateProcesses('Download'); 460 if(targetDownload.process === '') 461 { 462 $("#downloadButton").attr("disabled",true); 463 } 464 else 465 { 466 $("#downloadButton").attr("disabled",false); 467 } 468 }); 469//---------------------------------------------------------------------------------------------------------------------------// 470 471 472//---------------------------------------------------------------------------------------------------------------------------// 473// PROCESS SELECTS 474//---------------------------------------------------------------------------------------------------------------------------// 475 $("#processSelectDisplay").change( function processSelectDisplayChanged() { 476 target.process = $("#processSelectDisplay").find(":selected").val(); 477 target.estf = ''; 478 target.estflabel = ''; 479 target.vstf = ''; 480 $(".finalStateSelects").empty().append($("<option></option>")).attr("disabled",true); 481 if(target.process === 'excitation' || target.process === 'rovibrational_excitation' || target.process === 'ERD') 482 { 483 populateEstf(); 484 } 485 else 486 { 487 target.estf = ''; 488 target.estflabel = ''; 489 target.vstf = ''; 490 $(".finalStateSelects").empty().append($("<option></option>")).attr('disabled',true); 491 } 492 493 if(target.process != 'rovibrational_excitation') { 494 target.nsti = ''; 495 target.nstf = ''; 496 $(".rotStateSelects").empty().append($("<option></option>")).attr('disabled',true); 497 } 498 499 }); 500 $("#processSelectDownload").change( function processSelectDownloadChanged() { 501 targetDownload.process = $("#processSelectDownload").find(":selected").val(); 502 if(targetDownload.process === '') 503 { 504 $("#downloadButton").attr("disabled",true); 505 } 506 else 507 {
508 $("#downloadButton").attr("disabled",false); 509 } 510 }); 511//---------------------------------------------------------------------------------------------------------------------------// 512 513 514//---------------------------------------------------------------------------------------------------------------------------// 515// FINAL STATE SELECTS 516//---------------------------------------------------------------------------------------------------------------------------// 517 function populateEstf() { 518 if(target.process === 'excitation' || target.process === 'rovibrational_excitation' || target.process === 'ERD') 519 { 520 $.ajax({ 521 type: 'POST', 522 url: 'cgi-bin/scan_estf.php', 523 data: { proj: scatteringSystem.projectile, target: scatteringSystem.target, 524 esti: target.esti, vsti: target.vsti, process: target.process }, 525 dataType: "json", 526 success: function(response){ 527 let estfArray = response; 528 populateSelect($("#estfSelectDisplay"),estfArray,false); 529 if(estfArray.length == 1) 530 { 531 target.estf = estfArray[0]; 532 target.estflabel = labels[target.estf]; 533 console.log('only estf='+target.estf + ' available'); 534 } 535 else if(target.estf != '' && Array.from(document.getElementById("estfSelectDisplay").options).map(e => e.value).includes(target.estf)) 536 { 537 $("#estfSelectDisplay option[value="+target.estf+"]").attr('selected','selected'); 538 console.log('estf='+target.estf + ' still available'); 539 } 540 }, 541 async: false 542 }); //end AJAX 543 populateVstf(); 544 } 545 else 546 { 547 target.estf = ''; 548 target.estflabel = ''; 549 target.vstf = ''; 550 $(".finalStateSelects").empty().append($("<option></option>")).attr("disabled",true); 551 } 552 } 553 554 function populateVstf() { 555 let hasTot = false; 556 let hasDE = false; 557 let numv = 0; 558 let numOpt = 0; 559 let firstv = 0; 560 $.ajax({ 561 type: 'POST', 562 url: 'cgi-bin/scan_vstf.php', 563 data: { proj: scatteringSystem.projectile, target: scatteringSystem.target, 564 esti: target.esti, vsti: target.vsti, process: target.process, estf: target.estf }, 565 dataType:"json", 566 success: function(response){ 567 firstv = response[0]; 568 numv = response[1]; 569 if(response[2] == 1) hasTot = true; 570 if(response[3] == 1) hasDE = true; 571 numOpt = numv + response[2] + response[3]; 572 }, 573 async: false 574 }); //end AJAX 575 console.log("firstv, numv: " + firstv + " " + numv); 576 $("#vstfSelectDisplay").empty().attr("disabled",true); 577 if(numOpt > 1) $("#vstfSelectDisplay").append($("<option></option>")).attr("disabled",false); 578 if(hasTot) $("#vstfSelectDisplay").append($("<option></option>").val("Summed").html("Summed")); 579 if(hasDE) $("#vstfSelectDisplay").append($("<option></option>").val("DE").html("Dissociative excitation")); 580 vibInitialiser($("#vstfSelectDisplay"), firstv, numv, false); 581 console.log("numOpt: " + numOpt); 582 if(numOpt == 1) 583 { 584 target.vstf = $("#vstfSelectDisplay").find(":selected").val(); 585 console.log("vstf: " + target.vstf); 586 if(target.process === 'rovibrational_excitation') { 587 populateNsti(); 588 } 589 } 590 else if(target.vstf != '' && Array.from(document.getElementById("vstfSelectDisplay").options).map(e => e.value).includes(target.vstf)) 591 { 592 $("#vstfSelectDisplay option[value="+target.vstf+"]").attr('selected','selected'); 593 console.log('vstf='+target.vstf + ' still available'); 594 if(target.process === 'rovibrational_excitation') { 595 populateNsti(); 596 } 597 } 598 else if(target.vstf != '') 599 { 600 console.log('vstf='+target.vstf + ' no longer available'); 601 target.vstf = ''; 602 } 603 604 } 605 606 $("#estfSelectDisplay").change( function estfSelectDisplayChanged() { 607 target.estf = $("#estfSelectDisplay").find(":selected").val(); 608 target.estflabel = labels[target.estf]; 609 if(target.estf == '') 610 { 611 $("#vstfSelectDisplay").attr("disabled",true); 612 target.vstf = ''; 613 } 614 else 615 { 616 populateVstf(); 617 } 618 }); 619 $("#vstfSelectDisplay").change( function vstfSelectDisplayChanged() { 620 target.vstf = $("#vstfSelectDisplay").find(":selected").val(); 621 if(target.process == 'rovibrational_excitation') { 622 populateNsti(); 623 } 624 }); 625//---------------------------------------------------------------------------------------------------------------------------// 626 627 function populateNsti() { 628 //if(target.process 629 $.ajax({ 630 type: 'POST', 631 url: 'cgi-bin/scan_nsti.php', 632 data: { proj: scatteringSystem.projectile, target: scatteringSystem.target, 633 esti: target.esti, vsti: target.vsti, process: target.process, estf: target.estf, vstf: target.vstf }, 634 dataType:"json", 635 success: function(response){ 636 let nstiArray = response; 637 populateSelect($("#nstiSelectDisplay"),nstiArray,false); 638 if(nstiArray.length == 1) 639 { 640 target.nsti = nstiArray[0]; 641 console.log('only nsti='+target.nsti + ' available'); 642 } 643 else if(target.nsti != '' && Array.from(document.getElementById("nstiSelectDisplay").options).map(e => e.value).includes(target.nsti)) 644 { 645 $("#nstiSelectDisplay option[value="+target.nsti+"]").attr('selected','selected'); 646 console.log('nsti='+target.nsti + ' still available'); 647 } 648 }, 649 async: false 650 }); //end AJAX 651 } 652 $("#nstiSelectDisplay").change( function nstiSelectDisplayChanged() { 653 target.nsti = $("#nstiSelectDisplay").find(":selected").val(); 654 populateNstf(); 655 }); 656 657 function populateNstf() { 658 $.ajax({ 659 type: 'POST', 660 url: 'cgi-bin/scan_nstf.php', 661 data: { proj: scatteringSystem.projectile, target: scatteringSystem.target, 662 esti: target.esti, vsti: target.vsti, process: target.process, estf: target.estf, vstf: target.vstf, nsti: target.nsti }, 663 dataType:"json", 664 success: function(response){ 665 let nstfArray = response; 666 populateSelect($("#nstfSelectDisplay"),nstfArray,false); 667 if(nstfArray.length == 1) 668 { 669 target.nstf = estfArray[0]; 670 console.log('only nstf='+target.nstf + ' available'); 671 } 672 else if(target.nstf != '' && Array.from(document.getElementById("nstfSelectDisplay").options).map(e => e.value).includes(target.nstf)) 673 { 674 $("#nstfSelectDisplay option[value="+target.nstf+"]").attr('selected','selected'); 675 console.log('nstf='+target.nstf + ' still available'); 676 } 677 else 678 { 679 target.nstf = ''; 680 } 681 }, 682 async: false 683 }); //end AJAX 684 } 685 $("#nstfSelectDisplay").change( function nstfSelectDisplayChanged() { 686 target.nstf = $("#nstfSelectDisplay").find(":selected").val(); 687 }); 688 689 690//---------------------------------------------------------------------------------------------------------------------------// 691// PROCESSES 692//---------------------------------------------------------------------------------------------------------------------------// 693 function updateProcesses(card) { 694 //console.trace(); 695 let processSelect = $("#processSelect"+card); 696 let tar = ''; 697 //console.trace(); 698 if(card == 'Display') { tar = target } else { tar = targetDownload } 699 700 if(tar.esti === '' || tar.vsti === '') return 701 702 processSelect.empty(); 703 704 if(tar.esti === 'All') 705 { 706 processSelect.empty().attr('disabled',true).append($("<option></option>").val('All').html('All')); 707 tar.process = 'All'; 708 return 709 } 710 711 let proc = getProcesses(tar.esti,tar.vsti); 712 713 if(tar.vsti === 'All') 714 { 715 processSelect.append($("<option></option>")); 716 processSelect.append($("<option></option>").val('All').html('All')); 717 } 718 else if(Object.keys(proc).length > 1) 719 { 720 processSelect.append($("<option></option>")); 721 } 722 723 $.each(proc, function(key, value) { 724 processSelect.append($("<option></option>").val(key).html(value)); 725 }); 726 727 if(Object.keys(proc).length > 1 || tar.vsti === 'All') 728 {
729 processSelect.attr("disabled",false); 730 if(tar.process != '' && Object.keys(proc).includes(tar.process)) 731 { 732 $("#processSelect"+card+" option[value="+tar.process+"]").attr('selected','selected'); 733 console.log('process='+tar.process + ' still available'); 734 if(card == 'Display') populateEstf(); 735 } 736 else 737 { 738 tar.process = ''; 739 target.estf = ''; 740 target.vstf = ''; 741 $(".finalStateSelects").empty().append($("<option></option>")).attr('disabled',true); 742 target.nsti = ''; 743 target.nstf = ''; 744 $(".rotStateSelects").empty().append($("<option></option>")).attr('disabled',true); 745 746 } 747 } 748 else // only one process 749 { 750 tar.process=Object.keys(proc)[0] 751 $("#processSelect"+card+" option[value="+tar.process+"]").attr('selected','selected'); 752 processSelect.attr("disabled",true); 753 console.log('Only '+tar.process+' process available'); 754 if(card === 'Display' ) //&& tar.process === 'excitation' ) 755 { 756 populateEstf(); 757 } 758 else if (card === 'Download') 759 { 760 $("#downloadButton").attr("disabled",false); 761 } 762 } 763 764 return 765 } 766 767 function getProcesses(esti,vsti) { 768 let proc = {}; 769 let procAvail = {}; 770 let procLabels = { 771 excitation : 'excitation', 772 rovibrational_excitation : 'rovibrational excitation', 773 DE : 'dissociative excitation', 774 PP : 'proton production', 775 ionisation : 'ionisation', 776 dissociation : 'dissociation', 777 ERD : 'excitation + radiative decay', 778 grand_total : 'grand total' 779 } 780 $.ajax({ 781 type: 'POST', 782 url: 'cgi-bin/scan_process.php', 783 data: { proj: scatteringSystem.projectile, target: scatteringSystem.target, esti: esti, vsti: vsti }, 784 dataType:"json", 785 success: function(response){ procAvail = response; }, 786 async: false 787 }); //end AJAX 788 for (let i=0; i < procAvail.length; i++) { 789 proc = { ...proc, [procAvail[i]] : procLabels[procAvail[i]] } 790 } 791 return proc 792 } 793//---------------------------------------------------------------------------------------------------------------------------// 794 795 796//---------------------------------------------------------------------------------------------------------------------------// 797// DOWNLOADING 798//---------------------------------------------------------------------------------------------------------------------------// 799 $("#csFileDLButton").click( function csFileDLButtonClicked() { 800 $.ajax({ 801 type: 'POST', 802 url: 'cgi-bin/download_file.php', 803 data: { filePath : plotFilePath, fileName : plotFileName }, 804 success: function(response){ 805 window.location = response; 806 writeActivityLog("Download File",plotFileName); 807 } 808 }); 809 }); 810 $("#fitFileDLButton").click( function fitFileDLButtonClicked() { 811 $.ajax({ 812 type: 'POST', 813 url: 'cgi-bin/download_file.php', 814 data: { filePath : fitFilePath, fileName : fitFileName }, 815 success: function(response){ 816 window.location = response; 817 writeActivityLog("Download File",fitFileName); 818 } 819 }); 820 }); 821 $("#downloadButton").click( function downloadButtonClicked() { 822 let fileNameDownload = ''; 823 let zipNameDownload = ''; 824 if(targetDownload.esti === 'All') 825 { 826 fileNameDownload = baseFilePath; 827 zipNameDownload = fileNameDownload; 828 downloadFile(fileNameDownload,zipNameDownload); 829 } 830 else if (targetDownload.process === 'All' && targetDownload.vsti === 'All' ) 831 { 832 fileNameDownload = baseFilePath + '/' + baseFilePath + '-' + targetDownload.esti; 833 zipNameDownload = baseFilePath + '-' + targetDownload.esti; 834 downloadFile(fileNameDownload,zipNameDownload); 835 } 836 else if(targetDownload.vsti === 'All') 837 { 838 fileNameDownload = baseFilePath + '/' + baseFilePath + '-' + targetDownload.esti + '/' + targetDownload.process; 839 zipNameDownload = baseFilePath + '-' + targetDownload.esti + '-' + targetDownload.process; 840 downloadFile(fileNameDownload,zipNameDownload); 841 } 842 else 843 { 844 fileNameDownload = baseFilePath + '/' + baseFilePath + '-' + targetDownload.esti + '/' + targetDownload.process + '/vi='
844+ targetDownload.vsti; 845 zipNameDownload = baseFilePath + '-' + targetDownload.esti + '-vi=' + targetDownload.vsti + '-' + targetDownload.process; 846 console.log("download cs: " + fileNameDownload); 847 downloadFile(fileNameDownload,zipNameDownload); 848 849 //fileNameDownloadFits = baseFilePath + '/' + baseFilePath + '-' + targetDownload.esti + '/' + targetDownload.process + '/fits/vi=' + targetDownload.vsti; 850 //zipNameDownloadFits = baseFilePath + '-' + targetDownload.esti + '-vi=' + targetDownload.vsti + '-' + targetDownload.process + '_fits'; 851 //console.log("download fits: " + fileNameDownloadFits); 852 //downloadFile(fileNameDownloadFits,zipNameDownloadFits); 853 } 854 }); 855 856 function downloadFile(fileName,zipName) { 857 console.log("Downloading " + fileName); 858 $.ajax({ 859 type: 'POST', 860 url: 'cgi-bin/archive.php', 861 data: { fileName : fileName, zipName : zipName }, 862 success: function(response){ 863 window.location = response; 864 console.log("Download okay"); 865 }, 866 fail: function(response){ 867 console.log("Download failed"); 868 } 869 }); 870 writeActivityLog("Download Archive",zipName); 871 } 872 873 function writeActivityLog(action,name) { 874 let userLoc = Intl.DateTimeFormat().resolvedOptions().timeZone; 875 console.log("userLoc: " + userLoc); 876 if(userLoc == "Australia/Perth") return; 877 $.ajax({ 878 type: 'POST', 879 url: 'cgi-bin/log.php', 880 data: { userLoc : userLoc, action : action, name : name }, 881 success: function(response){ console.log("Log success"); }, 882 fail: function(response){ console.log("Log fail"); } 883 }); 884 } 885//---------------------------------------------------------------------------------------------------------------------------// 886 887 888//---------------------------------------------------------------------------------------------------------------------------// 889// DATA DISPLAY 890//---------------------------------------------------------------------------------------------------------------------------// 891 $(".displaySelects,#targetSelect").change( function displaySelectsOrTarget
891SelectChanged () { 892 console.log('>1'); 893 console.log(target.process); 894 if(target.esti === "" || target.vsti === "" || target.process === "") 895 { 896 hideData(); 897 console.log('>1'); 898 return false; 899 } 900 if( (target.estf === "" || target.vstf === "") && (target.process === 'excitation' || target.process === 'rovibrational_excitation' || target.process === 'ERD')) 901 { 902 hideData(); 903 console.log('>2'); 904 return false; 905 } 906 if( (target.nsti === "" || target.nstf === "") && target.process === 'rovibrational_excitation') 907 { 908 hideData(); 909 console.log('>3'); 910 return false; 911 } 912 913 console.log('>6'); 914 915 plotFileName = ''; 916 let dir = baseFilePath + '/' + baseFilePath + '-' + target.esti + '/' + target.process + '/vi=' + target.vsti; 917 let referenceText = ''; 918 document.getElementById('fitHead').innerHTML = ''; 919 fitFilePath = 'INVALID' 920 921 referenceText = getReference(); 922 923 let transitionLabelStart = "Transition: " + scatteringSystem.targetLabel + ' (' + target.estilabel + ', <i>v<sub>i</sub></i> = ' + target.vsti + ') → '; 924 let transitionLabelMid = ''; 925 let transitionLabelEnd = ''; 926 let transitionDescription = ''; 927 928 if(target.process === 'excitation') 929 { 930 fitDir = baseFilePath + '/' + baseFilePath + '-' + target.esti + '/'+target.process+'/fits/vi=' + target.vsti; 931 fitFileName = baseFilePath + '-' + target.estf + '.' + target.esti + '_vi=' + target.vsti + '_fit.txt'; 932 fitFilePath = fitDir + '/' + fitFileName; 933 934 document.getElementById('fitHead').innerHTML = "Fitting parameters for " + target.estilabel + '(<i>v<sub>i</sub></i> = ' + target.vsti + ') → ' 935 + target.estflabel + '(<i>v<sub>f</sub></i> ) transitions'; 936 937 if(target.vstf === 'DE') 938 { 939 plotFileName = baseFilePath + '-' + target.estf + '_DE' + '.' + target.esti + '_vi=' + target.vsti + '.txt'; 940 transitionLabelEnd = scatteringSystem.targetLabel + ' (' + target.estflabel + ')'; 941 transitionDescription = ' (dissociative excitation)' 942 } 943 else if(target.vstf === 'Summed') 944 { 945 plotFileName = baseFilePath + '-' + target.estf + '_total' + '.' + target.esti + '_vi=' + target.vsti + '.txt'; 946 transitionLabelEnd = scatteringSystem.targetLabel + ' (' + target.estflabel + ')'; 947 transitionDescription = ' (sum over <i>v<sub>f</sub></i> )' 948 } 949 else 950 { 951 plotFileName = baseFilePath + '-' + target.estf + '_vf=' + target.vstf + '.' + target.esti + '_vi=' + target.vsti + '.txt'; 952 transitionLabelEnd = scatteringSystem.targetLabel + ' (' + target.estflabel + ', <i>v<sub>f</sub></i> = ' + target.vstf + ')'; 953 } 954 } 955 956 else if(target.process === 'rovibrational_excitation') 957 { 958 fitDir = baseFilePath + '/' + baseFilePath + '-' + target.esti + '/'+target.process+'/fits/vi=' + target.vsti; 959 fitFileName = baseFilePath + '-' + target.estf + '_vf=' + target.vstf + '.' + target.esti + '_vi=' + target.vsti 960 961 if(target.nstf === target.nsti) 962 { 963 fitFileName = fitFileName + '_rot_elastic_fit.txt'; 964 } 965 else if(target.nstf > target.nsti) 966 { 967 fitFileName = fitFileName + '_rot_inelastic_fit.txt'; 968 } 969 else if(target.nstf < target.nsti) 970 { 971 fitFileName = fitFileName + '_rot_superelastic_fit.txt'; 972 } 973 974 fitFilePath = fitDir + '/' + fitFileName; 975 976 console.log(fitFilePath); 977 978 dir = dir + '/Ni=' + target.nsti; 979 plotFileName = baseFilePath + '-' + target.estf + '_vf=' + target.vstf + '_Nf=' + target.nstf + '.' + target.esti + '_vi=' + target.vsti + '_Ni=' + target.nsti + '.txt'; 980 transitionLabelStart = "Transition: " + scatteringSystem.targetLabel + ' (' + target.estilabel + ', <i>v<sub>i</sub></i> = ' + target.vsti + ', <i>N<sub>i</sub></i> = ' + target.nsti + ') → '; 981 transitionLabelEnd = scatteringSystem.targetLabel + ' (' + target.estflabel + ', <i>v<sub>f</sub></i> = ' + target.vstf + ', <i>N<sub>f</sub></i> = ' + target.nstf + ')'; 982 } 983 984 else if(target.process === 'dissociation' && scatteringSystem.target === 'H2' ) 985 { 986 plotFileName = baseFilePath + '-DISS' + '.' + target.esti + '_vi=' + target.vsti + '.txt';
987 transitionLabelEnd = 'atomic fragments'; 988 transitionDescription = ' (dissociation)'; 989 990 document.getElementById('fitHead').innerHTML = "Fitting parameters for " + target.estilabel + ' dissociation'; 991 992 } 993 else if(target.process === 'DE') 994 { 995 plotFileName = baseFilePath + '-DECS' + '.' + target.esti + '_vi=' + target.vsti + '.txt'; 996 transitionLabelEnd = 'atomic fragments'; 997 transitionDescription = ' (dissociative excitation)'; 998 999 document.getElementById('fitHead').innerHTML = "Fitting parameters for " + target.estilabel + ' dissociative excitation'; 1000 1001 } 1002 else if(target.process === 'PP') 1003 { 1004 plotFileName = baseFilePath + '-PP' + '.' + target.esti + '_vi=' + target.vsti + '.txt'; 1005 transitionLabelEnd = 'atomic fragments'; 1006 transitionDescription = ' (proton production)'; 1007 1008 document.getElementById('fitHead').innerHTML = "Fitting parameters for " + target.estilabel + ' dissociative excitation'; 1009 1010 } 1011 else if(target.process === 'ERD') 1012 { 1013 fitDir = baseFilePath + '/' + baseFilePath + '-' + target.esti + '/'+target.process+'/fits'; 1014 fitFileName = baseFilePath + '-' + target.estf + '.ERD.' + target.esti + '_vi=' + target.vsti + '_fit.txt'; 1015 fitFilePath = fitDir + '/' + fitFileName; 1016 plotFileName = baseFilePath + '-' + target.estf + '_vf=' + target.vstf + '.ERD.' + target.esti + '_vi=' + target.vsti + '.txt'; 1017 1018 transitionLabelMid = scatteringSystem.targetLabel + '<sup>*</sup> →  ' 1019 transitionLabelEnd = scatteringSystem.targetLabel + ' (' + target.estflabel + ', <i>v<sub>f</sub></i> = ' + target.vstf + ')'; 1020 1021 document.getElementById('fitHead').innerHTML = "Fitting parameters for " + target.estilabel + '(<i>v<sub>i</sub></i> = ' + target.vsti + ') → ' 1022 + scatteringSystem.targetLabel + '<sup>*</sup> → ' + target.estflabel + ' transitions'; 1023 } 1024 else if(target.process === 'ionisation') 1025 { 1026 fitDir = baseFilePath + '/' + baseFilePath + '-' + target.esti + '/'+target.process+'/fits'; 1027 fitFileName = baseFilePath + '-TICS.' + target.esti + '_fit.txt'; 1028 fitFilePath = fitDir + '/' + fitFileName; 1029 console.log('FIT:'+fitFilePath); 1030 plotFileName = baseFilePath + '-TICS' + '.' + target.esti + '_vi=' + target.vsti + '.txt'; 1031 transitionLabelEnd = scatteringSystem.targetLabel + '<sup>+</sup> + e<sup>-</sup> '; 1032 transitionDescription = ' (ionisation)'; 1033 } 1034 else if(target.process === 'grand_total') 1035 { 1036 plotFileName = baseFilePath + '-GTCS' + '.' + target.esti + '_vi=' + target.vsti + '.txt'; 1037 transitionLabelStart = scatteringSystem.targetLabel + ' (' + target.estilabel + ', <i>v<sub>i</sub></i> = ' + target.vsti + ')'; 1038 transitionDescription = ' (grand total cross section)'; 1039 } 1040 else 1041 { 1042 return 1043 } 1044 1045 document.getElementById('plotHead').innerHTML = transitionLabelStart + transitionLabelMid + transitionLabelEnd + transitionDescription; 1046 1047 plotFilePath = dir + '/' + plotFileName; 1048 1049 console.log(plotFilePath); 1050 writeActivityLog("View CS",plotFileName); 1051 1052 document.getElementById('reference').innerHTML = '<b><u>Reference</u>:</b> ' + referenceText 1053 makePlot(); 1054 $.ajax({ 1055 type: 'POST', 1056 url: 'cgi-bin/get_file.php', 1057 data: { filePath : plotFilePath }, 1058 success: function(response) { 1059 $("#csFilePrev").contents().find('body').html("<pre>" + response + "</pre>"); 1060 }, 1061 }); 1062 $.ajax({ 1063 type: 'POST', 1064 url: 'cgi-bin/get_file.php', 1065 data: { filePath : fitFilePath }, 1066 success: function(response) { 1067 $("#fitFilePrev").contents().find('body').html("<pre>" + response + "</pre>"); 1068 $("#fitFile").show(); 1069 $("#fitInfo").hide(); 1070 }, 1071 error: function(response) { 1072 $("#fitFile").hide(); 1073 $("#fitInfo").show(); 1074 } 1075 }); 1076 }); 1077 1078 function makePlot() { 1079 let scale = '1.0'; 1080 let unitLabel = ''; 1081 1082 if(scatteringSystem.projectile === 'prot' && scatteringSystem.target === 'H2' && plotSettings.usersetlogx === 'NO') 1083 { 1084 plotSettings.logx = 'ON'; 1085 } 1086 1087 if(plotSettings.logx === 'OFF') 1088 { 1089 document.getElementById('logxButton').innerHTML="Change to log x scale"; 1090 } 1091 else 1092 { 1093 document.getElementById('logxButton').innerHTML="Change to linear x scale"; 1094 } 1095 if(plotSettings.logy === 'OFF') 1096 { 1097 document.getElementById('logyButton').innerHTML="Change to log y scale"; 1098 } 1099 else 1100 { 1101 document.getElementById('logyButton').innerHTML="Change to linear y scale"; 1102 } 1103 if(plotSettings.units === 'au') 1104 { 1105 scale = '1.0'; 1106 unitLabel = 'a_0^2'; 1107 } 1108 else if(plotSettings.units === 'ang') 1109 { 1110 scale = '0.280029'; 1111 unitLabel = '{\305}^2' 1112 } 1113 else if(plotSettings.units === 'cm18') 1114 { 1115 scale = '28.003'; 1116 unitLabel = '10^{-18}cm^2'; 1117 } 1118 let xlabel = 'Incident '+projectiles[scatteringSystem.projectile]+' energy (eV)';
1119 let ylabel = 'Integrated cross section (' + unitLabel + ')'; 1120 console.log('FILEPATH: ' + plotFilePath); 1121 $.ajax({ 1122 type: 'POST', 1123 url: 'cgi-bin/make_plot.php', 1124 data: { fileName : plotFilePath, logx : plotSettings.logx, logy : plotSettings.logy, xlabel : xlabel, ylabel : ylabel, scale : scale }, 1125 success: function(response) { 1126 document.getElementById('plotImg').src = response; 1127 $("#csView").show(); 1128 $("#dbInfo").hide(); 1129 }, 1130 error: function() { 1131 console.log('Failed to make plot'); 1132 } 1133 }); 1134 } 1135 $("#logxButton").click( function logxButtonClicked() { 1136 plotSettings.usersetlogx = 'YES'; 1137 if(plotSettings.logx === 'OFF') { plotSettings.logx = 'ON'; } else { plotSettings.logx = 'OFF'; } 1138 makePlot(plotFilePath); 1139 return false; 1140 }); 1141 $("#logyButton").click( function logyButtonClicked() { 1142 if(plotSettings.logy === 'OFF') { plotSettings.logy = 'ON'; } else { plotSettings.logy = 'OFF'; } 1143 makePlot(plotFilePath); 1144 return false; 1145 }); 1146//---------------------------------------------------------------------------------------------------------------------------// 1147 1148 1149//---------------------------------------------------------------------------------------------------------------------------// 1150// MISC FUNCTIONS 1151//---------------------------------------------------------------------------------------------------------------------------// 1152 function populateSelect(select,array,addALL) { 1153 if(array.length == 0) 1154 { 1155 select.empty().append($("<option></option>")).attr('Disabled',true); 1156 } 1157 else if(array.length == 1) 1158 { 1159 select.empty().append($("<option></option>").val(array[0]).html(array[0])).attr('Disabled',true); 1160 } 1161 else 1162 { 1163 select.empty().append($("<option></option>")).attr('Disabled',false); 1164 if(addALL == true) 1165 { 1166 select.append($("<option></option>").val('All').html('All')); 1167 } 1168 for (var i=0; i < array.length; i++) { 1169 value = array[i]; 1170 select.append($("<option></option>").val(value).html(value)); 1171 } // end for 1172 } // end if 1173 } // end function populateSelect 1174 1175 function vibInitialiser(selector, firstv, numv, reset) { 1176 if(reset == true) 1177 { 1178 selector.empty().append($("<option></option>")).attr('Disabled',false); 1179 } 1180 for(let i = firstv;
1180 i < firstv+numv; i++) 1181 { 1182 selector.append($("<option></option>").val(i).html(i)); 1183 } 1184 } 1185 1186 function hideData() { 1187 $("#csView").hide(); 1188 $("#dbInfo").show(); 1189 } 1190 1191 function getReference() { 1192 let text = 'XXX'; 1193 1194 if(scatteringSystem.projectile === 'el' && target.process === 'ionisation' && ( scatteringSystem.target === 'H2' || scatteringSystem.target === 'D2' || scatteringSystem.target === 'T2' || scatteringSystem.target === 'HD' || scatteringSystem.target === 'HT' || scatteringSystem.target === 'DT') ) 1195 { 1196 text = '<a href="https://doi.org/10.1016/j.adt.2023.101573">Scarlett <i>et al</I>, Atom. Data Nucl. Data Tables <b>151</b>, 101573 (2023)</a>'; 1197 } 1198 else if(scatteringSystem.projectile === 'el' && scatteringSystem.target === 'H2' && target.esti == 'X1Sg') 1199 { 1200 if(target.process === 'excitation' && target.estf === 'X1Sg') 1201 { 1202 text = 'Scarlett <i>et al</I>, Phys. Rev. A, submitted (2026)</a>'; 1203 } 1204 else if(target.process === 'excitation') 1205 { 1206 text = '<a href="https://doi.org/10.1016/j.adt.2020.101361">Scarlett <i>et al</I>, Atom. Data Nucl. Data Tables <b>137</b>, 101361 (2021)</a>'; 1207 } 1208 else if(target.process === 'dissociation') 1209 { 1210 text = '<a href="http://dx.doi.org/10.3390/atoms7030075">Scarlett <i>et al</I>, Atoms <b>7</b>(3), 75 (2019)</a>'; 1211 } 1212 else if(target.process === 'ERD') 1213 { 1214 text = '<a href="http://dx.doi.org/10.1016/j.adt.2022.101534">Scarlett <i>et al</I>, Atom. Data Nucl. Data Tables. <b>148</b>, 101534 (2022)</a>'; 1215 //text = '<a href="http://dx.doi.org/10.1088/1361-6595/ab005b">Scarlett <i>et al</I>, Plasma Sources Sci. Technol. <b>28</b>, 025004 (2019)</a>'; 1216 } 1217 else if(target.process === 'rovibrational_excitation') 1218 { 1219 text = '<a href="https://doi.org/10.1103/PhysRevA.107.062804">Scarlett <i>et al</I>, Phys. Rev. A <b>107</b>, 062804 (2023)</a>'; 1220 } 1221 } 1222 else if(scatteringSystem.projectile === 'el' && ( scatteringSystem.target === 'D2' || scatteringSystem.target === 'T2' || scatteringSystem.target === 'HD' || scatteringSystem.target === 'HT' || scatteringSystem.target === 'DT') ) 1223 { 1224 if(target.process === 'excitation') 1225 { 1226 text = '<a href="https://doi.org/10.1016/j.adt.2020.101403">Scarlett <i>et al</I>, Atom. Data Nucl. Data Tables <b>139<b>, 101403 (2021)</a>'; 1227 } 1228 else if(target.process === 'ERD') 1229 { 1230 text = '<a href="http://dx.doi.org/10.1016/j.adt.2022.101534">Scarlett <i>et al</I>, Atom. Data Nucl. Data Tables. <b>148</b>, 101534 (2022)</a>'; 1231 } 1232 } 1233 else if(scatteringSystem.projectile == 'el' && scatteringSystem.target == 'H2') 1234 { 1235 text = '<a href="https://doi.org/10.1103/PhysRevA.103.032802">Scarlett <i>et al</I>, Phys. Rev. A <b>103</b>, 032802 (2021)</a>'; 1236 } 1237 else if(scatteringSystem.projectile === 'el' && ( scatteringSystem.target === 'H2plus' || scatteringSystem.target === 'D2plus' || scatteringSystem.target === 'T2plus' || scatteringSystem.target === 'HDplus' || scatteringSystem.target === 'HTplus' || scatteringSystem.target === 'DTplus') ) 1238 { 1239 text = '<a href="https://doi.org/10.1103/PhysRevA.90.022711">Zammit <i>et al</i>, Phys. Rev. A <b>90</b>, 022711 (2014)</a>'; 1240 } 1241 else if(scatteringSystem.projectile === 'pos' && scatteringSystem.target === 'H2' && target.esti === 'X1Sg' && target.estf !== 'X1Sg') 1242 { 1243 text = '<a href="https://doi.org/10.1103/PhysRevA.99.042705">Utamuratov <i>et al</I>, Phys. Rev. A <b>99</b>, 042705 (2019)</a>'; 1244 } 1245 else if(scatteringSystem.projectile === 'el' && scatteringSystem.target === '4HeHplus' ) 1246 { 1247 text = '<a href="https://doi.org/10.1103/PhysRevA.106.042818">Scarlett <i>et al</I>, Phys. Rev. A <b>106</b>, 042818 (2022)</a>'; 1248 } 1249 else if(scatteringSystem.projectile === 'pos' && scatteringSystem.target === 'H2plus' ) 1250 { 1251 text = '<a href="https://doi.org/10.1088/1361-6455/ab53a8">Mori <i>et al</I>, J. Phys. B <b>53</b>, 015203 (2020)</a>'; 1252 } 1253 else if(scatteringSystem.projectile === 'el' && scatteringSystem.target === '7LiH' ) 1254 { 1255 text = '<a href="https://doi.org/10.1103/PhysRevA.111.022810">Umer <i>et al</I>, Phys. Rev. A <b>111</b>, 022810 (2025)</a>, <br><a href="https://doi.org/10.1088/1361-6587/ae9077">Umer <i>et al</i>, Plasma Phys. Control. Fusion, <b>68</b>, 085053 (2026)</a>'; 1256 } 1257 else if(scatteringSystem.projectile === 'el' && scatteringSystem.target === '7Li2' ) 1258 { 1259 text = '<a href="https://doi.org/10.1103/32xb-j8rq">Umer <i>et al</I>, Phys. Rev. A <b>112</b>, 062810 (2025)</a>'; 1260 } 1261 else if(scatteringSystem.projectile === 'prot' && scatteringSystem.target === 'H2' ) 1262 { 1263 text = '<a href="https://doi.org/10.1088/1361-6587/ae464e">Plowman <i>et al</I>, Plasma Phys. Control. Fusion <b>68</b>, 035006 (2026)</a>'; 1264 } 1265 return text; 1266 1267 } 1268//---------------------------------------------------------------------------------------------------------------------------// 1269 1270 1271//---------------------------------------------------------------------------------------------------------------------------// 1272// DEBUGGING 1273//---------------------------------------------------------------------------------------------------------------------------// 1274// $(".systemSelects, .displaySelects, .downloadSelects" ).change( function debugLog() { 1275// console.log( 1276// 'proj: ' + scatteringSystem.projectile + ', ' + 1277// 'targetEl: ' + scatteringSystem.targetEl + ', ' + 1278// 'target: ' + scatteringSystem.target + ', ' + 1279// 'esti: ' + target.esti + ', ' + 1280// 'vsti: ' + target.vsti + ', ' + 1281// 'process: ' + target.process + ', ' + 1282// 'estf: ' + target.estf + ', ' + 1283// 'vstf: ' + target.vstf + ', ' + 1284// 'estiDL: ' + targetDownload.esti + ', ' + 1285// 'vstiDL: ' + targetDownload.vsti + ', ' + 1286// 'processDL: ' + targetDownload.process); 1287// console.log(baseFilePath); 1288// console.log(''); 1289// } ); 1290//---------------------------------------------------------------------------------------------------------------------------// 1291 1292 function updateHelpText() { 1293 document.getElementById('help-text-system').innerHTML = 'Select a projectile first, and the target selection will become available. Where applicable, the most common isotoplogue will be selected by default but this can be changed (when there is data available).'; 1294 if(scatteringSystem.projectile == '' || scatteringSystem.target == '') 1295 { 1296 var text = 'Select a projectile and target in the red block first'; 1297 document.getElementById('help-text-display').innerHTML = text; 1298 document.getElementById('help-text-download').innerHTML = text; 1299 } 1300 else 1301 { 1302 document.getElementById('help-text-display').innerHTML = 'Select the initial vibronic (vibrational + electronic) state first, and then the collision process (note that "excitation" includes elastic and superelastic scattering when available). Where applicable, the options to select the final vibronic state and the rotational levels will become available. When the rotational level selections are not available all data is summed/averaged over final/initial rotational states.';
1303 document.getElementById('help-text-download').innerHTML = 'Download all data or a subset of the data for the selected collision system. Selecting "All" initial electronic states will default to downloading the entire dataset, or select a specific state and then choose the initial vibrational level and collision process of interest. When rovibrationally-resolved data is downloaded it always includes all initial rotational levels. Fits are only included in the download when "All" initial vibrational levels are selected.' 1304 } 1305 } 1306 1307 1308 1309});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.