Sample JAVA program to compute the electron's orbit of the beryllium (Be) of Bohr model.

Back to the beryllium page
Top page ( correct Bohr model including the two electron atom )

In this program, we first input the initial x-coordinate ra (in MM) of electron 1.
Here we use the new units, ( 1 MM = 10-14 meter, 1 SS = 10-22 second, 1 MM/SS = 108 m/s ).
After the electron moves one round of the orbit, and the number of de Broglie's waves becomes just 2 (this point is the last point of the electron 1),
this program outputs the following values on the screen;
last coordinate, last velocity ( VX,VY in MM/SS ), last distance between nucleus and electron 1,
inner product of last velocity and last coordinate (= VXA*xxa + VYA*yya ),
longest and shortest distances between nucleus and electron 1 in the orbit.


import java.util.Scanner;
class MathMethod {
 public static void main(String[] args) {
 
 Scanner stdIn=new Scanner(System.in);     
 System.out.println("ra between nucleus and electron 1 (MM)? ");  
 double ra=stdIn.nextDouble(); 
                               // E=ionization energy (eV) of Be (1st+2nd) 
 double E=-27.533; double EE=E*1.60217646e-19;
 double me=9.1093826e-31; 
 double pai=3.141592653589793; double epsi=8.85418781787346e-12;
 double h=6.62606896e-34; double ele=1.60217653e-19;

double rra=ra*1.0e-14;
                                    // keee=distance between 2S and 1S electron
double keee=Math.sqrt(1430*1430+ra*ra);keee=keee*1.0e-14;
double potenc=(4*ele*ele)/(4*pai*epsi*keee);
double poten=potenc-(2*4*ele*ele)/(4*pai*epsi*rra)+(ele*ele)/(4*pai*epsi*(2*rra));
                                // Ta=initial kinetic energy=total-potential energy
double Ta=EE-poten;   

 if (Ta >0) {
                               
 double vya=Math.sqrt(Ta/me); 
 double VYA=vya*1.0e-8;         // change m/sec to MM/SS <

 double prexa=ra;  double preya=0.0; double VXA=0.0;  
 double WNA=0.0; 
 double xxa,vka,innerpro,lastdista,kko; double yya=0.0; 
 double bigdis=ra; double shortdis=ra; 
  
 do {
    xxa=prexa+VXA; yya=preya+VYA;   // position after 1SS
    
    kko=Math.sqrt(xxa*xxa+yya*yya); //kko=distance between nucleus and electron
    
    if (bigdis < kko) {bigdis=kko;}
    
    if (shortdis > kko) {shortdis=kko;}
    vka=VXA*VXA+VYA*VYA;               
                                     
    WNA=WNA+(me*vka*1.0e-6)/h;  // number of de Broglie's wave
                      
                                // distances between particles
    double ka=Math.sqrt(prexa*prexa+preya*preya);       
    double kb=Math.sqrt(prexa*prexa+preya*preya+1430*1430);
    double kc=Math.sqrt(4*prexa*prexa+4*preya*preya);
                                   
    ka=ka*1.0e-14; kb=kb*1.0e-14; kc=kc*1.0e-14; 
    prexa=prexa*1.0e-14; preya=preya*1.0e-14;
    double ac=(ele*ele)/(4*pai*epsi*me);
                                         
    VXA=VXA+1.0e-30*ac*(-(4*prexa)/(ka*ka*ka)+(2*prexa)/(kb*kb*kb)+(2*prexa)/(kc*kc*kc));   
    VYA=VYA+1.0e-30*ac*(-(4*preya)/(ka*ka*ka)+(2*preya)/(kb*kb*kb)+(2*preya)/(kc*kc*kc));

    prexa=xxa;preya=yya;
  
   } while (WNA <2.0);              //repeat above until WNA=2.0
            
  lastdista=Math.sqrt(xxa*xxa+yya*yya);
  innerpro=VXA*xxa+VYA*yya;        // innerpro =innerproduct of last velocity and coordinate
  System.out.printf("ra:%.2f ", ra);
  System.out.printf("last distance:%.5f ", lastdista);
  System.out.printf("xxa:%.2f ", xxa);
  System.out.printf("yya:%.2f ", yya);
  System.out.printf("VXA:%.5f ", VXA);
  System.out.printf("VYA:%.5f\n", VYA);
  System.out.printf("inner product:%.5f ", innerpro);
  System.out.printf("longest distance:%.2f ", bigdis);
  System.out.printf("shortest distance:%.2f ", shortdis);
  System.out.printf("WNA:%.2f\n", WNA);
  
   }}}