Sample JAVA program computing atomic radius ( carbon, oxigen, boron )

Top page (correct Bohr model including helium).
Back to molecular bond 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 wave, so save this text editor as "wave.java", and compile it.)
Here we use the new unit of 1 MM = 1 × 10-14 meter.

In this program, first we choose the kind of atoms.
If you compute carbon like atoms (= C, Si ), input the value of "0", first.
If you compute oxygen-like (= O, Si ) or boron-like (= B, Al ) atoms input "1" or "2", respectively.

Next input the central charge Z and total ionization energies of all valence electrons.
From these inputted values, this program compute potential energies and force of tetrahedral carbon.
And using Virial theorem ( E = -T = 1/2 V ), this program calculate de Broglie wave in one orbit
On the screen, this de Broglie wave's number (= almost 2.0 ), and the distance (MM) between each valence electron and the central nucleus are shown.


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

          // choose carbon-like = 0, oxygen-like = 1, boron like = 2 
 Scanner stdIn=new Scanner(System.in);
 System.out.println(" First, input 0, 1, or 2 to choose atoms  ");   
 System.out.println("( Carbon, Si = 0, Oxygen, S = 1, Boron, Al = 2  )  ");  
 double fig=stdIn.nextDouble(); 

                  // input central positive charge Z   
 System.out.println("central charge Z ?  ");  
 double Z=stdIn.nextDouble(); 

                   // input total ionization energy |E| eV
 System.out.println("total ionization energies |E| eV ?  ");  
 double E=stdIn.nextDouble(); 

 
 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 ke=(ele*ele)/(4.0*pai*epsi);

                         // total  potential energy (J) by Virial theorem
 double poten = -2.0 * E * 1.602177e-19;   


 // Carbon-like atoms ( C, Si )
   
                 // length r from potenial V in tetrahedron
 double r =(ke/poten) * (-(8.0*Z)/Math.sqrt(6.0) + 3.0);
                
                   // kinetic = total kinetic energy by Virial theorem        
 double kinetic=-0.5*poten;       
 double velo=Math.sqrt((kinetic)/(2.0*me));  // velo = electron's velocity (m/s) 
                      // F = force acting on each electron (N)
 double F = (ke/(r*r))*(Z*2.0/3.0 - Math.sqrt(6.0)/4.0  );

                       // nuc = distance between electron and nucleus
 double nuc=r*Math.sqrt(6)/2.0;  

 double radius=(me*velo*velo)/F; // rotation radius from centrifugal force
 double debroglie = h/(me*velo);       // de Broglie wavelength of electron
 double wave=(2.0*pai*radius)/debroglie;  // wave's number in one orbit


  // oxygen-like atoms ( O, S )

   if ( fig == 1 ) {
                     // a = distance between electron and nucleus
     double a = (ke/poten)*(-6.0*Z + 12.0/Math.sqrt(2)+1.5);
                          // velo = veclocity of each  electron 0-5
     velo=Math.sqrt(kinetic/(3.0*me));

                         //  F = force acting on each electron (N)
     F = (ke/(a*a))*(Z-2.0/Math.sqrt(2)-0.25);

  radius=(me*velo*velo)/F; // rotation radius from centrifugal force
  debroglie = h/(me*velo);       // de Broglie wavelength of electron
  wave=(2.0*pai*radius)/debroglie;  // wave's number in one orbit
    nuc = a;
     }

    // Boron -like atoms ( B, Al ) 

   if ( fig == 2 ) {
                             // r = distance between electron and nucleus
    r =(ke/poten) * (-(3.0*Z) + Math.sqrt(3));  
                                
                      // velo = velocity of each electron 0-2 
    velo=Math.sqrt((2.0*kinetic)/(3.0*me)); 
                     // F = force acting on each electron
    F = (ke/(r*r))*(Z - 1.0/(Math.sqrt(3)) );


    radius=(me*velo*velo)/F;  // rotation radius from centrifugal force
    debroglie = h/(me*velo);      // de Broglie wavelength of electron
    wave=(2.0*pai*radius)/debroglie;  // wave's number in one orbit

    nuc = r;
    }
  
   nuc = nuc * 1.0e14;  // change meter to MM

   System.out.printf("de Broglie wave in one orbit : %.3f \n", wave);
   System.out.printf("distance between electron and nucleus: %.2f ", nuc);
   System.out.printf("                        \n");

 }}