diff --git a/beamRate.py b/beamRate.py new file mode 100755 index 0000000..112b789 --- /dev/null +++ b/beamRate.py @@ -0,0 +1,35 @@ +#!/usr/bin/python3 +#run as python3 frib_rate.py -1 0 +#y1 is PAC2 +#y is ultimate + +import ssl +ssl._create_default_https_context = ssl._create_unverified_context + +import sys +import urllib.request + +import cgi, cgitb + +form = cgi.FieldStorage() +A=form.getvalue('A') +Z=form.getvalue('Z') +I=form.getvalue('I') + +print( "Content-type:text/html\r\n\r\n") + +#print("==== requesting FRIB rate for A = %s, Z = %s " % (A, Z)) + +url = "https://groups.nscl.msu.edu/frib/rates/source/frib_yieldY.php?a="+A + "&z=" + Z + "&y=y" + +fp = urllib.request.urlopen(url) + +list = fp.read().decode("utf8").split(",") + +#for haha in list: +# print(haha) + +print(list[5]) + + + diff --git a/heliosmatics.html b/heliosmatics.html index 6817251..9e2c805 100644 --- a/heliosmatics.html +++ b/heliosmatics.html @@ -75,6 +75,7 @@ MeV + Target (a): diff --git a/heliosmatics.js b/heliosmatics.js index fae1f46..e69d42e 100644 --- a/heliosmatics.js +++ b/heliosmatics.js @@ -47,6 +47,7 @@ function deleteRow(){ var beam = []; //A, Z, Mass, Name, Sn, Sp, Sa var beamMass; +var yield; var target= []; var light=[]; var heavy=[]; //A, Z, Mass, Name, Sn, Sp, Sa @@ -110,6 +111,17 @@ var color = ['rgb(31,119,180)', // muted blue 'rgb(118,189,34)', // curry yellow-green 'rgb(23,190,207)']; // blue-teal +function GetYield(A,Z){ + let str = 'beamRate.py?A=' + A + '&Z=' + Z; + let client = new XMLHttpRequest(); + client.onreadystatechange = function() { + let haha = client.responseText.split(","); + yield = haha[0] + } + client.open('GET', str, false); + client.send(); +} + function GetMassFromSym(AZ, id){ let str = 'massProxy.py?AZ=' + AZ; @@ -124,6 +136,7 @@ function GetMassFromSym(AZ, id){ beam[4] = parseFloat(mass[4]); beam[5] = parseFloat(mass[5]); beam[6] = parseFloat(mass[6]); + GetYield(beam[0], beam[1]); } if( id == 1 ){ target[0] = parseInt(mass[0]); @@ -175,6 +188,8 @@ function GetMass(){ document.getElementById('heavyName').innerHTML = heavy[3]; document.getElementById('heavySp').innerHTML = 'Sn: ' + heavy[4] + ' MeV, Sp: ' + heavy[5] + ' MeV, Sa : ' + heavy[6] + ' MeV'; + //document.getElementById('beamSp').innerHTML = "haah"; + document.getElementById('beamYield').innerHTML = "FRIB ultimate yield : " + yield + " pps"; //document.getElementById('n0').innerHTML = beam[0] + "," + beam[1] + "," + beam[2] //document.getElementById('n1').innerHTML = target[0] + "," + target[1] + "," + target[2] //document.getElementById('n2').innerHTML = light[0] + "," + light[1] + "," + light[2] @@ -1126,7 +1141,6 @@ function Plot3D(){ } - GetMass(); CalConstants(); SetSSType(); diff --git a/index.html b/index.html index 28c7149..739ac2b 100644 --- a/index.html +++ b/index.html @@ -16,9 +16,9 @@ body { font-family: Arial, Helvetica, sans-serif; } - table, th, td { - //border: 1px solid black; - } + /* table, th, td { */ + /* border: 1px solid black; */ + /* } */ table.center{ margin-left: auto; margin-right: auto; @@ -34,7 +34,7 @@ float: left; width : var(--navWidth); height: 100vh; - //background: #6DB33E; + /* background: #6DB33E; */ background: #1363A7; padding: 0px; } @@ -43,7 +43,7 @@ padding: 0px; margin-left: var(--navWidth); height : 100vh; - //background: #1363A7; + /* background: #1363A7; */ background: #6DB33E; } a { @@ -122,6 +122,12 @@ Intructions & Credits + + Woods-Saxon (to be done) + + + Nuclides Chart (to be done) + diff --git a/nuclearChart.html b/nuclearChart.html new file mode 100644 index 0000000..7f2bb84 --- /dev/null +++ b/nuclearChart.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuclearChart.js b/nuclearChart.js new file mode 100644 index 0000000..14c00bf --- /dev/null +++ b/nuclearChart.js @@ -0,0 +1,229 @@ + +const mp = 938.27208816; +const mn = 939.56542052; + +class Isotope { + constructor(A, Z, BE, symbol){ + this.A = A; + this.Z = Z; + this.N = A - Z; + this.BE = BE; + this.symbol = symbol; + this.mass = Z*mp +this.N*mn - BE*A/1000.; + this.stable = false; + }; + Print(){ + console.log(this.A + this.symbol); + }; +} + +const size = 30; // size of each ele square +const maxN = 177; +const maxZ = 118; + +const padX = 100; +const padY = 100; +const startY = size*maxZ; +const startX = 0; + +var AllIso = []; // 2D AllIso[N][Z] +for( let i = 0; i <= maxN; i++){ + const row = []; + for( let j = 0; j <= maxZ; j++){ + row.push(new Isotope(NaN, NaN, NaN, NaN, NaN)); + } + AllIso.push(row); +} + +function readLocalFile(){ + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function () { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status === 200) { + //console.log(xhr.responseText); + let lines = xhr.responseText.split('\n').slice(36); + lines.forEach(element => { + let z = parseInt(element.substring(11,15)); + let a = parseInt(element.substring(16,20)); + let sym = element.substring(20,22).trim(); + let be = parseFloat(element.substring(56,67).trim()); + const iso = new Isotope(a, z, be, sym); + if( !isNaN(a) && !isNaN(z)) AllIso[a-z][z] = iso; + }); + } else { + console.error('Error reading the file:', xhr.statusText); + } + } + }; + xhr.open('GET', 'Cleopatra/mass20.txt', false); + xhr.send(); +} + + + +function makeElement(x,y, A, text, fillColor){ + var square = new paper.Path.Rectangle({ + point: [x + size*0.1/2, y + size*0.1/2], + size: [size*0.9, size*0.9], + fillColor: fillColor, // Filling color of the square + //strokeColor: 'black', // Border color of the square + //strokeWidth: 1 // Border width of the square + }); + + // Create a text item inside the square + var textItemA = new paper.PointText({ + point: [x + size / 2 - 2, y + size / 2 + 5], // Center of the square + content: A, + justification: 'right', + fontSize: size * 0.2, // Adjust font size based on the size of the square + fillColor: 'black' // Color of the text + }); + + var textItem = new paper.PointText({ + point: [x + size / 2 - 2, y + size / 2 + 5], // Center of the square + content: text, + justification: 'left', + fontSize: size * 0.3, // Adjust font size based on the size of the square + fillColor: 'black' // Color of the text + }); + + // Group the square and text together + var group = new paper.Group([square, textItem, textItemA]); + + textItemA.position.y -= 5; + + // Add event handlers for mouseenter and mouseleave events + group.onMouseEnter = function (event) { + square.fillColor = 'orange'; // Change the filling color when hovering over + }; + + group.onMouseLeave = function (event) { + square.fillColor = fillColor; // Restore the original filling color when the mouse leaves + }; + + return group; // Return the group containing the square and text +} + +function checkBounded(num1, num2, num3) { + const numbers = [num1, num2, num3]; + + let countNaN = 0; + for (const num of numbers) { + if(!isNaN(num) && num < 0) { + return false; + }else{ + countNaN ++; + } + } + if( countNaN == 3) { + return true; + }else{ + return false; + } + + return true; +} + +//#################################### +window.onload = function(){ + + paper.setup('nuclearChart'); + const project = paper.project; + + project.view.viewSize = new paper.Size( maxN * size + padX*2, maxZ*size + padY*2); + + readLocalFile(); + + for( let i = 0; i <= maxN; i++){ + for( let j = 0; j <= maxZ; j++){ + let iso = AllIso[i][j]; + if( !isNaN(iso.A) ){ + // iso.Print(); + + let Sp = NaN; + let Sn = NaN; + let Sa = NaN; + + if( j > 1) Sp = AllIso[i][j-1].mass + mp - iso.mass; + if( i > 1) Sn = AllIso[i-1][j].mass + mn - iso.mass; + if( i > 2 && j > 2) Sa = AllIso[i-2][j-2].mass + AllIso[2][2].mass - iso.mass; + + //if( iso.Z > 55 && iso.N >= 82 ) console.log( iso.A + iso.symbol + " | " + Sp + "," + Sn + "," + Sa); + if( checkBounded(Sp, Sn, 1) ){ + let Qbm = NaN; + let Qbp = NaN; + let Qec = NaN; + + if( i > 0 && j < maxZ ) Qbm = iso.mass - AllIso[i-1][j+1].mass - 0.511; + if( j > 0 && i < maxN ) Qbp = iso.mass - AllIso[i+1][j-1].mass - 0.511; + if( j > 0 && i < maxN ) Qec = iso.mass - AllIso[i+1][j-1].mass + 0.511; + + //if( iso.Z > 55 && iso.N >= 82 )console.log( iso.A + iso.symbol + " | " + iso.mass + " | " + Qbm + "," + Qbp + "," + Qec); + if( Qbm > 0 || Qbp > 0 || Qec > 0 || (iso.Z > 83 && Sa < 0 ) || (iso.Z < 20 && Sa < 0 ) ){ + makeElement(startX + i * size + padX, startY - j*size + padY, AllIso[i][j].A, AllIso[i][j].symbol, 'white'); + }else{ + makeElement(startX + i * size + padX, startY - j*size + padY, AllIso[i][j].A, AllIso[i][j].symbol, 'grey'); + } + + }else{ + makeElement(startX + i * size + padX, startY - j*size + padY, AllIso[i][j].A, AllIso[i][j].symbol, 'white'); + } + + } + } + } + + //Draw magic line + var magic = [2, 8, 20, 28, 40, 50, 82, 126]; + for( let i = 0; i < 8; i++){ + let haha1 = new paper.Path(); + haha1.strokeColor = 'black'; + haha1.strokeWidth = 1; + + let minY = maxZ; + let maxY = 0; + for( let Z = 0; Z < maxZ; Z ++){ + if( AllIso[magic[i]][Z].A > 0 ){ + if( minY > Z) minY = Z; + if( maxY < Z) maxY = Z; + } + } + minY -= 1; + + haha1.moveTo(new paper.Point(startX + padX + magic[i]*size, startY - minY*size + padY)); + haha1.lineTo(new paper.Point(startX + padX + magic[i]*size, startY - maxY*size + padY)); + + let haha2 = new paper.Path(); + haha2.strokeColor = 'black'; + haha2.strokeWidth = 1; + haha2.moveTo(new paper.Point(startX + padX + (magic[i]+1)*size, startY - minY*size + padY)); + haha2.lineTo(new paper.Point(startX + padX + (magic[i]+1)*size, startY - maxY*size + padY)); + + let minX = maxN; + let maxX = 0; + for( let N = 0; N < maxN; N ++){ + if( AllIso[N][magic[i]].A > 0 ){ + if( minX > N) minX = N; + if( maxX < N) maxX = N; + } + } + maxX += 1; + + let haha3 = new paper.Path(); + haha3.strokeColor = 'black'; + haha3.strokeWidth = 1; + haha3.moveTo(new paper.Point( startX + minX*size + padX, padY + startY - (magic[i]-1)*size)); + haha3.lineTo(new paper.Point( startX + maxX*size + padX, padY + startY - (magic[i]-1)*size)); + + let haha4 = new paper.Path(); + haha4.strokeColor = 'black'; + haha4.strokeWidth = 1; + haha4.moveTo(new paper.Point( startX + minX*size + padX, padY + startY - (magic[i])*size)); + haha4.lineTo(new paper.Point( startX + maxX*size + padX, padY + startY - (magic[i])*size)); + + } + + + + paper.view.draw(); +} \ No newline at end of file