Home page
Back to chemistry 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 twoele, so save this text editor as "twoele.java", and compile it.)
In this program, we first choose a two-electron atom or ion whose energy we want to calculate, and input the chosen two-electron ion's atomic number Z = 2 (= He = helium ), 3 (= Li+ = singly-ionized lithium ), 4 (= Be2+ = doubly-ionized beryllium ), 5 (= B3+ ), 6 (= C4+ ), 7 (= N5+ ), 8 (= O6+ ), 9 (= F7+ ), 10 (= Ne8+ ), 11 (= Na9+ ), 12 (= Mg10+ ), 13 (= Al11+ ). 14 (= Si12+ ), 15 (= P13+ ), or 16 (= S14+ )...
Next we input the initial x-coordinate r1 (in unit MM = 1.0 × 10-14 meter ) of electron 1, and the absolute value of the total energy |E| (in eV) of the two-electron atoms (ions) that we want to calculate.
From the inputted values of atomic energy and initial coordinate, this program outputs the total de Broglie wavelength (= WN ) of 1/4 orbit, and the last x,y-velocity (= VX, VY ) of the electron-1, after the electron-1 has moved its 1/4 orbit from the initial x-axis to y-axis, by updating electrons' coordinate and velocity at short time intervals.
Here we use new convenient units 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 = 1032 m/s^2.
The initial electron-1's x-coordinate (= r1 ) is automatically increased per calculation until r1 +100 (= there is only one r1 which gives the last VY velocity being zero in each chosen atomic energy |E| ).
import java.util.Scanner;
class twoele {
public static void main(String[] args) {
// all two-electron helium-line atoms, ions
// input atomic number = Z
Scanner stdIn=new Scanner(System.in);
System.out.println("Atomic number Z ? (He=2, Li+=3, Be2+=4, B3+=5, C4+=6, N5+=7...)");
double Z=stdIn.nextDouble();
// input initial electron-1's x-coordinate r1
System.out.println("r1 between nucleus and electron 1 (MM)? ");
double r=stdIn.nextDouble();
// input energy |E| of helium-like atoms
System.out.println("absolute value of energy |E| of the two-electron atom (eV) ? ");
double E=stdIn.nextDouble();
// me = electron's mass (kg)
double me=9.1093826e-31;
// pai = pi, epsi = electric constant
double pai=3.141592653589793;
double epsi=8.85418781787346e-12;
// h = Planck constant, ele = electron charge
double h=6.62606896e-34;
double ele=1.60217653e-19;
// reduced mass = rm (= only light He, Li+ )
double nucle=2.0*me;
double nuclee=0.0;
// He alpha particle (Z=2)
if (Z < 2.5 ) { nucle = 6.64465650e-27; nuclee=nucle;}
// Li7 nucleus (Z=3)
if ( Z > 2.5 && Z < 3.5 ) { nucle = 1.1646e-26; nuclee=nucle;}
double rm=(2.0*me*nucle)/(2.0*me+nuclee); rm=rm*0.5;
// rm is ordinary electron mass in all ions
// other than light He and Li+
// Ene = wrong circular He orbit's energy
double Ene=-((4.0*Z-1)*(4.0*Z-1)*ele*ele*ele*ele*me)/(64.0*epsi*epsi*h*h);
Ene=Ene*6.241509e18; System.out.printf("Wrong Energy of circular orbit: %.3f\n", Ene);
for (int i=1;i < 100;i++) {
// repeat computing until r1 becomes r1+100
// poten = initial Coulomb potential energy
double poten=-(2.0*Z*ele*ele)/(4.0*pai*epsi*r*1.0e-14)+(ele*ele)/(4.0*pai*epsi*2.0*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(vya/me);
// VX,VY = electron-1's x,y-velocity (MM/SS)
double VY=vyb*1.0e-9; double VX = 0.0;
// prexx, preyy = electron-1's coordinate
double prexx=r; double preyy = 0.0;
// WN = number of de Broglie wavelength
double WN=0.0;
double yy,vk,leng,wav;
double xx=0.0;
do {
// xx, yy = electron-1's coordinate after 1SS
xx=prexx+VX; yy=preyy+VY;
vk=VX*VX+VY*VY;
// leng = electron moving length for 1SS (m)
leng=Math.sqrt(vk)*1.0e-14;
// wav = de Broglie wavelength = h/mv (m)
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);
// rb = distance between two electrons
double rb=Math.sqrt(4.0*prexx*prexx+2.0*preyy*preyy);
// change unit from MM to meter
ra=ra*1.0e-14; rb=rb*1.0e-14;
prexx=prexx*1.0e-14; preyy=preyy*1.0e-14;
double ac=(ele*ele)/(4.0*pai*epsi*rm);
// computing acceleration from Coulomb force
// update x-velocity VX, acceleration (MM/SS^2)
VX=VX+1.0e-32*ac*prexx*(-Z/(ra*ra*ra)+2.0/(rb*rb*rb));
// update y-velocity VY from acceleration
VY=VY+1.0e-32*ac*preyy*(-Z/(ra*ra*ra)+1.0/(rb*rb*rb));
prexx=xx;preyy=yy;
} while (xx >=0);
// until electron-1 has moved 1/4 orbit
// which means until electron-1 reaches y-axis
// display the initial x-coordinate r1 increasing
System.out.print("r1: "+r+" ");
// display last velocity VX,VY of electron
System.out.printf("VX:%.6f ", VX);
System.out.printf("VY:%.6f ", VY);
// WN = total de Broglie wavelength of 1/4 orbit
System.out.printf("WN:%.6f\n", WN);
} r=r+1;
}}}