Nuclear Binding Energy

Nuclear Binding Energy

This program might be useful to a chemistry or physics teacher at the high school level.
'Nuclear binding energy
'Version 2.0 by Scott Ausbrooks, May, 2011
 
'This program calculates the nuclear mass defect and the nuclear
'binding energy in both KJ/mol and MeV/nucleon
 
nomainwin
 WindowWidth = 900
 WindowHeight = 500
 button #1.button1,"Calculate",[action], UL, 10,30,120,50
 button #1.button2,"Clear",[clear], LL, 10,20,120,50
 button #1.button3,"Exit",[quit],LR,120,60,120,50
 textbox #1.textbox1, 650, 30, 180, 60 'measured mass of nucleus
 textbox #1.textbox2, 650, 130, 180, 60'mass# of isotope
 textbox #1.textbox3, 650, 230, 180, 60'atomic #
 textbox #1.textbox4, 110, 120, 180, 60'mass defect result
 textbox #1.textbox5, 110, 200, 180, 60'BE KJ/mol result
 textbox #1.textbox6, 110, 280, 180, 60'BE MeV/nucleon result
 statictext #1.measuredmass, "Measured mass ",500,40,110,50
 statictext #1.isotopicmass, "Isotopic mass # ",500,140,100,50
 statictext #1.atomicnum, "Atomic # ",500,250,100,50
 statictext #1.mdresult1, "Mass Defect",25,120,80,100
 statictext #1.mdresult2, "amu",300,130,45,45
 statictext #1.KJresult1, "Binding Energy",20,200,90,100
 statictext #1.KJresult2, " KJ/mol",290,215,90,35
 statictext #1.MeVresult1, "Binding Energy",20,290,90,75
 statictext #1.MeVresult2, "MeV / Nucleon",290,300,200,25
 
 open "Binding Energy Calculator" for window as #1
 print #1, "font times_new_roman 18 BOLD"
 print #1.textbox1, "!setfocus"
 print #1, "trapclose [quit]"
 wait
[action]
 print #1.textbox1,"!contents?"
 input #1.textbox1, actualmass$
 
 print #1.textbox2,"!contents?"
 input #1.textbox2, massnumber$
 
 print #1.textbox3,"!contents?"
 input #1.textbox3, protons$
 mole = 6.022e23
 actualmass = val(actualmass$)
 massnumber = val(massnumber$)
 protons = val(protons$)
 neutrons = massnumber - protons
 massdefect = ((protons * 1.007276) + (neutrons * 1.008665) ) - actualmass
 KJ = (massdefect * 1.6606e-27 * ((2.9979e8)^2) * mole)/1000
 MeVperNucleon = ((KJ * 1000)/(mole *1.602e-13 * massnumber))
 
 print #1.textbox4, "!font times_new_roman 18 bold"
 print #1.textbox4, massdefect
 print #1.textbox5, "!font times_new_roman 18 bold"
 print #1.textbox5, KJ
 print #1.textbox6, "!font times_new_roman 18 bold"
 print #1.textbox6, MeVperNucleon
 wait
 
[clear]
 print #1.textbox1, ""
 print #1.textbox2, ""
 print #1.textbox3, ""
 print #1.textbox4, ""
 print #1.textbox5, ""
 print #1.textbox6, ""
 print #1.textbox1, "!setfocus"
wait
 
[quit]
 confirm "Really quit?";answer$
 if answer$ = "no" then wait
 close #1:end