Sample JAVA program of the helium (straight-line motion of the nucleus).

top page
Back to no helium compound page

If you copy and paste the program source code below into a text editor, you can easily compile and run this.
(This class file name is perpen, so save this text editor as "perpen.java", and compile it.)
In this program, we first input the initial y-coordinate r2 (in MM) of electron 1, and the absolute value of the total energy E (in eV) of Helium. From the inputted values, this program outputs the x component of electron 1 velocity in Fig.19, and WN (the number of de Broglie's waves contained in one quarter of the orbital). Here 1 SS = 1 × 10-23 second.
The initial y-coodinate is automatically increased per calculation until +30.


import java.util.Scanner;
class perpen {
 public static void main(String[] args) {   //  1SS = 10^-23 sec, 
                                         // two electrons start at right angles
 
 Scanner stdIn=new Scanner(System.in);    
                                       
                                       // input r2 and |E|
 System.out.println("r2 between nucleus and electron 1 (MM) ?");  
 double r=stdIn.nextDouble();
 System.out.println("total energy |E| in the herium (eV) ? ");  
 double E=stdIn.nextDouble();
 
 double me=9.1093826e-31; 
 double nucle=6.64465650e-27;
 double rm=(2*me*nucle)/(2*me+nucle); rm=rm*0.5;  // rm =reduced mass
 
 double pai=3.141592653589793; double epsi=8.85418781787346e-12;
 double h=6.62606896e-34; double ele=1.60217653e-19;
 double rtwo=Math.sqrt(2);  // rtwo=square root of 2

 for (int i=1;i < 30;i++) {      // repeat until r2=initial r2+30
                                
                             // calculation of initial VY from E and r2    
double poten=-(2*ele*ele*2)/(4*pai*epsi*r)+(ele*ele)/(4*pai*epsi*rtwo*r);
                             
                             //vya= total E-potential energy= kinetic energy  
double vya=-(E*1.60217646e-19)-poten*1.0e14; 
 if (vya > 0) {
              double vyb=0.0;  // vyb=initial velocity of one of two electrons (m/s)

   vyb=Math.sqrt(vya/me);       // initial states = usual electron mass 
 double VX=-vyb*1.0e-9;         // change m/sec to MM/SS
 
 double prexx=0.0; double VY=0.0; double WN=0.0; double preyy=r; 
 double xx,yy,vk,preVX,preWN,midWN;
  
 do {
    xx=prexx+VX; yy=preyy+VY;        //electron 1 position after 1SS
    preVX=VX;preWN=WN ;
    vk=VX*VX+VY*VY;                  //calculation of WN from VX,VY 
                                    // adding number of de Broglie waves
    WN=WN+(rm*vk*1.0e-5)/h;                       
                                   //calculation of VX,VY from Coulomb force
    double ra=Math.sqrt(prexx*prexx+preyy*preyy);       
    double rb=Math.sqrt(4.0*prexx*prexx+2.0*preyy*preyy);
    ra=ra*1.0e-14; rb=rb*1.0e-14; 
    prexx=prexx*1.0e-14; preyy=preyy*1.0e-14;
    double ac=(2*ele*ele)/(4*pai*epsi*rm);
                                        // change velocity VX from Coulomb force
    VX=VX+1.0e-32*ac*prexx*(-1.0/(ra*ra*ra)+1.0/(rb*rb*rb));   
                                        // change velocity VY from Coulomb force
    VY=VY+1.0e-32*ac*preyy*(-1.0/(ra*ra*ra)+0.5/(rb*rb*rb));
    prexx=xx;preyy=yy;
  
   } while (yy > 0);              //repeat above until electron 1 arive at x axis 
   if (VX > -0.00001 && VX < 0.00001) {    // last VX condition           
  System.out.print("r1: "+r+"   ");
  System.out.printf("VY:%.6f   ", VY);
  System.out.printf("VX:%.6f   ", VX);
  System.out.printf("preVX:%.6f  ", preVX);
  midWN=(preWN+WN)/2; System.out.printf("midWN:%.6f  \n", midWN);
    }
   }  r=r+1;
   }}}