One-electron hydrogen atomic energy.

Control sample JAVA program to calculate hydrogen (= H ) atom or helium ion (= He+ ) with one electron.

Home page

Copy & paste sample program of H atom.

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 MathMethod, so save this text editor as "MathMethod.java", and compile it.)

Choose H or He+ atom, reduced mass or not.

In this program, first we input the atomic number Z ( 1 = hydrogen H atom, 2 = helium He+ ion ) and whether you use reduced mass (= 0 ) or the original electron mass without reduced mass

Display theoretical hydrogen energy, radius

From these values, it outputs theoretical values (= hydrogen solution of Bohr model or Schrodinger equation ) of total energy and (Bohr) radius of the hydrogen-like atoms.

Input hydrogen's energy.

Input the initial electron's x-coordinate (= r ) and total energy of H (or He+ ) atom.

Then we input the initial x-coordinate r1 (in MM = 1.0 × 10-14 meter ) of electron (= electron starts from x-axis to y-axis ), and the absolute value of the total energy E (in eV) of H or He+ atom.

Output de Broglie wavelength of 1/4 orbit.

From the input H or He+'s total energy and initial electron's x-coordinate, this program outputs de Broglie wavelength of 1/4 orbit, after the electron moves from x-axis to y-axis.

From these inputted values of total energy of H or He+ atoms, this program outputs de Broglie wavelength (= WN ) of 1/4 orbit, x,y-components of the last velocity (= VX, VY ) of the electron after the electron has moved its 1/4 orbit from x-axis to y-axis.

↑ When the orbit is symmetrically circular, this last velocity's y-component (= VY ) becomes zero = the electron crosses y-axis perpendicularly after moving its 1/4 orbit.

Unit

Here we use new convenient unit of time = 1 SS = 1 × 10-23 second,  length = 1 MM = 1 × 10-14 meter,   velocity = 1MM/SS = 1×109 m/s,  acceleration = 1MM/SS^2 = 1 × 1032 m/s^2.

The initial x-coordinate r of the electron is automatically increased per calculation of 1/4 orbit until +100.
This method is the same as neutral helium program.

Theoretical H or He+'s energy and radius

Theoretical values of energy and radius based on Bohr model or Schrodinger equation are:
In hydrogen atom (H), total energy = -13.60569 eV, and Bohr radius = 5291.77 MM.
Using reduced mass, total energy = -13.59829 eV, and radius = 5294.65 MM.
In helium ion (He+), total energy = -54.42277 eV, and radius = 2645.89 MM.
Using reduced mass, total energy = -54.41531 eV, and radius = 2646.25 MM.
In these values, one-orbit is just 1 × de Broglie wavelength, and last VY is just zero (= meaning this orbit becomes just symmetrically circular like the theoretical Bohr's hydrogen ). Try them.

↑ For example, after starting this program, when we input Z = 1 (= H atom ), reduced mass (= 0 ), initial r1 = 5294.65 (MM), total energy |E| of H atom = 13.59829 (eV), this program outputs the total de Broglie wavelength of 1/4 orbit equal to just 0.250000, and (last)VY velocity equal to just zero (= 0.000000 ), last-y-coordinate equal to the initial r1 (= meaning a symmetrical circular orbit ).

 


import java.util.Scanner;
 class MathMethod {
 public static void main(String[] args) {

// hydrogen like atoms (= H or He+ ) 

// input atomic number Z  
                        
 Scanner stdIn=new Scanner(System.in);
 System.out.println("Atomic number Z ( H = 1,  He+ = 2 ) ? ");  
 double Z=stdIn.nextDouble();

// input whether use reduced mass (= 0 ) 
// or the original electron mass (= 1 )

 System.out.println("You use reduced mass (= 0 ) or usual electron mass (= 1 ) ? ");  
 double whi=stdIn.nextDouble();
 
// me = electron mass

 double me=9.1093826e-31;

// epsi = electric constant,  pai = pi

 double epsi=8.85418781787346e-12;
 double pai=3.141592653589793; 

// h = Planck constant
// ele = electron's charge

 double h=6.62606896e-34;
 double ele=1.60217653e-19;

// mp = mass of a proton (= H atomic nucleus ) 
 
 double mp=1.67262171e-27;  

// alph = mass of helium mass
    
 double alph = 6.64465650e-27;  

// rm = reduced mass

 double rm=me;                 
 if (Z < 1.5) { rm=(me*mp)/(me+mp); }      
 if (Z > 1.5 ) { rm=(me*alph)/(me+alph);}
 if (whi > 0.5 ) { rm=me; }
                              
// toenergy = theoretical energy of H or He+

 double toenergy = -(Z*Z*rm*ele*ele*ele*ele)/(8.0*epsi*epsi*h*h); 

// radius = theoretical radius of H or He

 double radius = (epsi*h*h)/(pai*rm*Z*ele*ele);

// change energy unit from J to eV

 toenergy = toenergy * 6.241509e18;

// change length unit from meter to MM
     
 radius = radius * 1.0e14;    

// display theoretical energy, radius 

 System.out.printf("Theory-total energy: %.5f ", toenergy);
 System.out.printf("Theory-radius: %.2f \n", radius);

System.out.println(" \n");
           
// input the initial electron's x-coordinate r
                        
 System.out.println("initial r between nucleus and electron  (MM)? ");  
 double r=stdIn.nextDouble();

// input total energy |E| of H or He+ 

 System.out.println("absolute value of total energy |E| of H or He+ atom (eV) ? ");  
 double E=stdIn.nextDouble();

// increase r per calculation until r+100

 for (int i=1;i < 100;i++) {     

// poten = initial Coulomb potential energy
              
 double poten=-(Z*ele*ele)/(4.0*pai*epsi*r*1.0e-14);
                             
//vya= total E-potential energy (J) 

 double vya=-(E*1.60217646e-19)-poten; 

 if (vya > 0) {

// vyb=electron initial velocity (m/sec)
 
 double vyb=Math.sqrt((2*vya)/rm); 

// change velocity unit from m/s to MM/SS
// VX, VY = x, y-velocity of the electron.

 double VY=vyb*1.0e-9; double VX = 0.0; 

// prexx, preyy = electron's x,y coordinate  
   
 double prexx=r;  double preyy=0.0; 

// WN = sum of de Broglie wavelength

double WN=0.0; 

 double yy,vk,leng,wav; double xx=0.0;
  
 do {

// xx, yy = electron's position after 1SS

    xx=prexx+VX; yy=preyy+VY;        
    vk=VX*VX+VY*VY;    

// leng = moving length (= m ) for 1SS   
           
    leng=Math.sqrt(vk)*1.0e-14;   
 
// wav = de Broglie wavelength (= meter ) 

     wav=h/(rm*Math.sqrt(vk)*1.0e9); 

// WN = sum of de Broglie wavelength

    WN=WN+leng/wav;               
     
// ra = distance between electron and nucleus 
                             
 double ra=Math.sqrt(prexx*prexx+preyy*preyy); 
  
// change unit from MM to meter  
                                
    ra=ra*1.0e-14; 
    prexx=prexx*1.0e-14; preyy=preyy*1.0e-14;

    double ac=(ele*ele)/(4.0*pai*epsi*rm);

// update electron's x,y velocity = VX, VY
// from Coulomb force
                                    
// acceleration (= MM/SS^2) of electron

VX=VX+1.0e-32*ac*prexx*(-Z/(ra*ra*ra));
VY=VY+1.0e-32*ac*preyy*(-Z/(ra*ra*ra));

    prexx=xx;preyy=yy;

  
   } while (xx >=0);  

// electron has moved 1/4 orbit            
          
  System.out.print("r1: "+r+"   ");

// display electron's last velocity VX, VY

  System.out.printf("VX:%.6f ", VX);
  System.out.printf("VY:%.6f ", VY);

// display electron's last y-coordinate

  System.out.printf("last-y:%.2f ", yy);

// display de Broglie wavelength of 1/4 orbit

  System.out.printf("WN:%.6f\n", WN);
    
   }  r=r+1;
   }}}