Back to the neon page
Top page ( correct Bohr model including the two electron atom )
This program is a little long. So if you copy and paste the below program source code into a text editor,
you can easily compile and run this.
This program's class file name is neon5, so save this text editor as "neon5.java", and compile it.
In this program, the neon nucleus (gray color) is at (9285.6MM, 12499MM, 11857MM).
Here we use the new units, ( 1 MM = 10-14 meter, 1 SS = 10-21 second, 1 MM/SS = 107 m/s ).
Each coordinate of electrons (+X (MM), +Y (MM), +Z (MM)) in the text box means "relative" position from this nucleus.
"nuc (MM)" means the distance between the nucleus and each electron.
"VX: VY: VZ" means the ratio of each component of the electron's initial velocity vector.
So, (VX: VY; VZ)=(100:100;0) is the same as (VX: VY: VZ) = (10:10:0).
When you choose the number (= wn) of de Broglie's waves (0.1 -- 2.0) in the scrollbar, and click "orbit" button, this program starts to compute the electron's orbit until de Broglie's waves contained in the orbit becomes wn.
And then, if you click "return" button, all electrons return to the initial(starting) conditions.
You can change the coordinates and the direction of velocity vector freely.
(Enter the values into the textboxes, and press the Enter key.)
And when you enter the value r (MM) into the textbox next to "radius" button and click this button, the size (radius) of neon changes as shown in Fig.3.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Scanner;
public class neon5 extends JPanel // visualization of neon atom
{ // central charge =+8.4
public static void main(String arg[])
{ // set frame
JFrame frame = new JFrame("visualization of neon");
J2DPanel j2dpanel = new J2DPanel();
frame.getContentPane().add(j2dpanel);
frame.setSize(1180,720);
frame.setVisible(true);
frame.setBackground(Color.black);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class J2DPanel extends JPanel implements AdjustmentListener, ActionListener
{
double pai=3.141592653589793; double epsi=8.85418781787346e-12;
double h=6.62606896e-34; double elc=1.60217653e-19;
double me=9.1093826e-31; double den=8.4; // den= central charge=8.4
JTextField elp[][]=new JTextField[8][7]; // coordinate and velocity text
JTextField impho=new JTextField(7);
JButton b1=new JButton("orbit"); // button definition
JButton b2=new JButton("return");
JButton b3=new JButton("radius");
String ope[]={"0.1","0.3","0.5","0.8","1.0","1.1","1.3","1.5","1.7","1.9","2.0"};
JComboBox coom=new JComboBox(ope); // de Broglie's wave selection
double rtw=Math.sqrt(2); double rth=Math.sqrt(3); double rsi=Math.sqrt(6);
double rfi=Math.sqrt(5); int marki[]={0,0,0,0,0,0,0,0}; // marki=marking
double hpr[][]=new double[8][7]; double hhpr[][]=new double[8][7];
double nux[]={9285.64, 12499.90, 11857.08}; // nux=nucleus coordinate (MM)
public J2DPanel()
{
setBackground(Color.black);
JPanel p=new JPanel(); p.setLayout(new GridLayout(10,8));
String vv,zww; int aaa=0;
for (int el=0; el <=7; el++) { // elp[el][0-2]=each electron's coordinate
for (int pos=0; pos <=2; pos++) {
elp[el][pos]=new JTextField(7); elp[el][pos].addActionListener(this);
}}
for (int el=0; el <=7; el++) {
for (int pos=3; pos <=6; pos++) { // elp[][3-6]=other parameterts of electron
elp[el][pos]=new JTextField(7);
if (pos > 3) {elp[el][pos].addActionListener(this);}
}}
// layout
String mida[]={"Electron","+ X (MM)","+ Y (MM)","+ Z (MM)", "nuc(MM)"," VX : ", " VY : ", " VZ : "};
for (int pos=0; pos <=7; pos++) {
p.add(new Label(mida[pos]));}
for (int el=0; el <=7; el++) {
p.add(new Label("ele "+el+" "));
for (int pos=0; pos <=6; pos++) {
p.add(elp[el][pos]); elp[el][pos].setText("0");
}}
p.add(b1); p.add(coom); p.add(b2); p.add(b3); p.add(impho);
p.add(new Label(" --- ")); p.add(new Label(" --- ")); p.add(new Label(" --- "));
impho.setText("2925"); coom.setSelectedItem("2.0");
b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);
add(p,"South");
// hpr[0-7][0-2]=initial coordinates of electrons
double sd1=2925.0; double sd2=sd1/rtw; double sd3=sd2;
hpr[0][0]=sd1+nux[0]; hpr[1][0]=nux[0]; hpr[2][0]=nux[0]-sd1; hpr[3][0]=nux[0];
hpr[0][1]=nux[1]; hpr[3][1]=nux[1]-sd1; hpr[1][1]=nux[1]+sd1; hpr[2][1]=nux[1];
hpr[4][0]=nux[0]+sd2; hpr[5][0]=nux[0]+sd2; hpr[4][1]=nux[1]-sd2; hpr[5][1]=nux[1]+sd2;
hpr[6][0]=nux[0]-sd2; hpr[7][0]=nux[0]-sd2; hpr[6][1]=nux[1]+sd2; hpr[7][1]=nux[1]-sd2;
hpr[0][2]=nux[2]+sd3; hpr[1][2]=hpr[0][2]; hpr[2][2]=hpr[0][2]; hpr[3][2]=hpr[0][2];
hpr[4][2]=nux[2]-sd3; hpr[5][2]=hpr[4][2]; hpr[6][2]=hpr[4][2]; hpr[7][2]=hpr[4][2];
double zah1=0.0; int zai1=0;
for (int el=0; el <=7; el++) {
for (int pos=0; pos <=2; pos++) { // calculate coordinate to two decimal places
// change to the relative coordinate
zai1=(int)(100*(hpr[el][pos]-nux[pos])); zah1=zai1/100.0;
elp[el][pos].setText(Double.toString(zah1)); hhpr[el][pos]=hpr[el][pos];
}}
// initial velocity vector of electron
double velo[][]={{0,100,0},{-100,0,0},{0,-100,0},{100,0,0},{50,50,0},{-50,50,0},{-50,-50,0},{50,-50,0}};
for (int el=0; el <=7; el++) {
for (int pos=0; pos <=2; pos++) { // set velocity vector of electron (=hpr[0-7][4-6])
hpr[el][pos+4]=velo[el][pos]; hhpr[el][pos+4]=hpr[el][pos+4];
elp[el][pos+4].setText(Double.toString((double)velo[el][pos]));
}}
double inik=0.0; // show distance between nucleus and electron (=elp[0-7][3])
for (int el=0; el <=7; el++) {
inik=Math.sqrt((hpr[el][0]-nux[0])*(hpr[el][0]-nux[0])+
(hpr[el][1]-nux[1])*(hpr[el][1]-nux[1])+(hpr[el][2]-nux[2])*(hpr[el][2]-nux[2]));
hpr[el][3]=inik; hhpr[el][3]=inik;
aaa=(int)(inik*100.0); inik=aaa/100.0; // calculate the diatance to two decimal places
elp[el][3].setText(Double.toString(inik));
}
} // method end
public void adjustmentValueChanged(AdjustmentEvent e) {
repaint();
}
public void actionPerformed(ActionEvent e) {
String ss;
int RR; double Rf1,Rf2,Rf3,Rf4; int teis=0;
for (int ett=0; ett <=7; ett++) { // when coordinate texts change
for (int sws=0; sws <=2; sws++) { // marki[2] becomes 2 only after orbiting
if (e.getSource()==elp[ett][sws] && marki[2] !=2 ) {
marki[4]=1;
ss=elp[ett][sws].getText(); Rf1=Double.parseDouble(ss);
Rf2=(Rf1+nux[sws])/71.428; // plus nuclear coordinate and change to pixel
Rf3=Rf1+nux[sws]; hpr[ett][sws]=Rf3; hhpr[ett][sws]=Rf3;
// upper and lower limits of coordinate
if (Rf2 > 319 && sws==0) {Rf3=319*71.428;teis=1;}
if (Rf2 > 349 && sws==2) {Rf3=349*71.428;teis=1;}
if (Rf2 > 349 && sws==1) {Rf3=349*71.428;teis=1;}
if (Rf2 < 1) {Rf3=71.428;teis=1;}
RR=(int)(100*(Rf3-nux[sws])); // change to relative coordinate
Rf1=RR/100.0;
if (teis==1) {elp[ett][sws].setText(Double.toString(Rf1));}
}}}
if (e.getSource() == b1 && marki[2] !=2) {marki[0]=1;} // b1="orbit" button
if (e.getSource() == b2) {marki[1]=1;} // b2=return to the starting points
if (e.getSource() == b3 && marki[2] !=2) { // change radius of neon
marki[4]=1; // marki[4] becomes 1 when coordinates change
ss=impho.getText(); Rf1=Double.parseDouble(ss);
Rf2=Rf1/rtw;
hpr[0][0]=Rf1+nux[0]; hpr[1][0]=nux[0]; hpr[2][0]=nux[0]-Rf1; hpr[3][0]=nux[0];
hpr[0][1]=nux[1]; hpr[3][1]=nux[1]-Rf1; hpr[1][1]=nux[1]+Rf1; hpr[2][1]=nux[1];
hpr[4][0]=nux[0]+Rf2; hpr[5][0]=nux[0]+Rf2; hpr[4][1]=nux[1]-Rf2; hpr[5][1]=nux[1]+Rf2;
hpr[6][0]=nux[0]-Rf2; hpr[7][0]=nux[0]-Rf2; hpr[6][1]=nux[1]+Rf2; hpr[7][1]=nux[1]-Rf2;
hpr[0][2]=nux[2]+Rf2; hpr[1][2]=hpr[0][2]; hpr[2][2]=hpr[0][2]; hpr[3][2]=hpr[0][2];
hpr[4][2]=nux[2]-Rf2; hpr[5][2]=hpr[4][2]; hpr[6][2]=hpr[4][2]; hpr[7][2]=hpr[4][2];
for (int ett=0; ett <=7; ett++) {
for (int sws=0; sws <=2; sws++) { // calculate the values to two decimal places
RR=(int)(100*(hpr[ett][sws]-nux[sws])); Rf1=RR/100.0;
elp[ett][sws].setText(Double.toString(Rf1));
hhpr[ett][sws]=hpr[ett][sws];
}}
}
repaint();
}
public void update(Graphics g) {
paint(g);
}
public void paintComponent(Graphics g) {
double kro,krr,krk,pot,pota,potb,gx,gy,gz; int ex,ey,ez,xk,yk,zk; String ww,pyw;
double rhp[][]= {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
int qpp[][]=new int[8][3];
double ggx,ggy,ggz; double ttav,toav; int tttav;
ggx=0.0; ex=0;
if (marki[2] != 2) { // get values from textfield
for (int ett=0; ett <=7; ett++) {
for (int sws=3; sws <=6; sws++) {
ww=elp[ett][sws].getText(); ggx=Double.parseDouble(ww);
hpr[ett][sws]=ggx; hhpr[ett][sws]=hpr[ett][sws];
}}}
if (marki[1]==1 && marki[2]==2) { // return to the starting points
for (int qz=0; qz <=7; qz++) {
for (int ka=0; ka <=6; ka++) {
if (ka < 3) {ggx=hpr[qz][ka]-nux[ka]; ex=(int)(100*ggx); ggx=ex/100.0;}
else {ex=(int)(100*hpr[qz][ka]); ggx=ex/100.0; }
elp[qz][ka].setText(Double.toString(ggx));
hhpr[qz][ka]=hpr[qz][ka];
}}
marki[1]=0; marki[2]=0;
}
if (marki[2] !=2) { // before calculation of electron's orbit
toav=0.0; // toav =total potential energy (eV)
for (int yp=0; yp <=7; yp++) { // calculate repulsive forces between electrons
for (int kj=0; kj <= 7; kj++) {
if (yp < kj ) {
// kro=distance between electrons
kro=Math.sqrt((hpr[yp][0]-hpr[kj][0])*(hpr[yp][0]-hpr[kj][0])+
(hpr[yp][1]-hpr[kj][1])*(hpr[yp][1]-hpr[kj][1])+(hpr[yp][2]-hpr[kj][2])*(hpr[yp][2]-hpr[kj][2]));
if (kro==0) {kro=5000.0;}
// pot=potential energy between electrons (eV)
pot=(elc*elc*6.241509e18)/(4*pai*epsi*kro*1.0e-14);
// rhp[][0]=potential energy of each electron
rhp[yp][0]=rhp[yp][0]+pot/2; rhp[kj][0]=rhp[kj][0]+pot/2;
toav=toav+pot;
}
} }
for (int rv=0; rv <=7; rv++) {
// kro=distance between Ne nucleus and electrons
kro=Math.sqrt((hpr[rv][0]-nux[0])*(hpr[rv][0]-nux[0])+
(hpr[rv][1]-nux[1])*(hpr[rv][1]-nux[1])+(hpr[rv][2]-nux[2])*(hpr[rv][2]-nux[2]));
if (kro == 0) {kro=5000.0;}
hpr[rv][3]=kro; hhpr[rv][3]=kro;
ex=(int)(100.0*kro); ggx=ex/100.0; // calculate to two decimal place
elp[rv][3].setText(Double.toString(ggx)); // show nuc(MM)
ttav= (-den*elc*elc*6.241509e18)/(4*pai*epsi*kro*1.0e-14);
rhp[rv][0]=rhp[rv][0]+ttav; toav=toav+ttav; // add potential energy
}
// distribute each kinetic energy based on each V
gy=-953.6126/8; // -953.6126=the sum of 1-8th ionization energies of neon (eV).
for (int rv=0; rv <=7; rv++) {
rhp[rv][1]=gy-rhp[rv][0]; // rhp[][1]=kinetic energy (eV)
}
} // if (marki[2] !=2 ) end
// ----------orbit calculation start ----------
if (marki[0]==1) { // put orbit button
double sj[][]=new double[8][13]; double wn=0.0; double nvx[]=new double[3];
String pew=(String)coom.getSelectedItem();
if (pew == "0.1") {wn=0.1;} if (pew == "0.3") {wn=0.3;}
if (pew == "0.5") {wn=0.5;} if (pew == "0.8") {wn=0.8;}
if (pew == "1.0") {wn=1.0;} if (pew == "1.1") {wn=1.1;}
if (pew == "1.3") {wn=1.3;} if (pew == "1.5") {wn=1.5;}
if (pew == "1.7") {wn=1.7;} if (pew == "1.9") {wn=1.9;}
if (pew == "2.0") {wn=2.0;}
for (int kj=0; kj <=2; kj++) {
nvx[kj]=nux[kj]*1.0e-14; } // change MM to meter in Ne nucleus coordinate
for (int yp=0; yp <=7; yp++) {
sj[yp][9]=0.0; // sj[][9]=number of de Broglie's waves
gx=Math.sqrt(hpr[yp][4]*hpr[yp][4]+hpr[yp][5]*hpr[yp][5]+hpr[yp][6]*hpr[yp][6]);
gy=Math.sqrt((2.0*rhp[yp][1]*1.602177e-19)/me); // gy=initial velocity (m/s)
for (int kj=0; kj <=2; kj++) {
sj[yp][kj] = hpr[yp][kj]; sj[yp][kj+6]=sj[yp][kj]; //sj[][0-2], sj[][6-8] =each coordinate
sj[yp][kj+3]=(gy*1.0e-7*hpr[yp][kj+4])/gx; // sj[][3-5] =each component of velocity(MM/SS)
sj[yp][kj+10]=0.0; // sj[][10-12] =each component of acceleration (MM/SS^2)
}}
double ac=(elc*elc)/(4*pai*epsi*me);
do {
for (int yp=0; yp <=7; yp++) {
for (int kj=0; kj <=2; kj++) {
sj[yp][kj]=sj[yp][kj+6]+sj[yp][kj+3]; // electron's position(MM) after 1SS
sj[yp][10+kj]=0.0;
}}
for (int yp=0; yp <=7; yp++) {
gx=sj[yp][3]*sj[yp][3]+sj[yp][4]*sj[yp][4]+sj[yp][5]*sj[yp][5];
sj[yp][9]=sj[yp][9]+(me*gx*1.0e-7)/h; // add de Brogli's waves
for (int kj=0; kj <=2; kj++) {
sj[yp][kj+6]=sj[yp][kj+6]*1.0e-14; // change MM to meter
}}
for (int yp=0; yp <=7; yp++) { // interaction between electrons
for (int kj=0; kj <=7; kj++) {
if (yp < kj) { // gy=distances between electrons
gy=Math.sqrt((sj[yp][6]-sj[kj][6])*(sj[yp][6]-sj[kj][6])+
(sj[yp][7]-sj[kj][7])*(sj[yp][7]-sj[kj][7])+(sj[yp][8]-sj[kj][8])*(sj[yp][8]-sj[kj][8]));
for (int rv=0; rv <=2; rv++) {
gx=(1.0e-28*ac*(sj[yp][rv+6]-sj[kj][rv+6]))/(gy*gy*gy); // set acceleration(gx) at sj[][10-12]
sj[yp][rv+10]=sj[yp][rv+10]+gx ;sj[kj][rv+10]=sj[kj][rv+10]-gx ;
}}}}
for (int yp=0; yp <=7; yp++) { // gy=distances between electron and Ne nucleus
gy=Math.sqrt((sj[yp][6]-nvx[0])*(sj[yp][6]-nvx[0])+
(sj[yp][7]-nvx[1])*(sj[yp][7]-nvx[1])+(sj[yp][8]-nvx[2])*(sj[yp][8]-nvx[2]));
for (int rv=0; rv <=2; rv++) {
gx=(1.0e-28*den*ac*(sj[yp][rv+6]-nvx[rv]))/(gy*gy*gy); // gx=acceleration by nucleus
sj[yp][rv+10]=sj[yp][rv+10]-gx;
}}
for (int yp=0; yp <=7; yp++) {
for (int kj=0; kj <=2; kj++) {
sj[yp][kj+6]=sj[yp][kj];
sj[yp][kj+3]=sj[yp][kj+3]+sj[yp][kj+10]; // change velocity vector
}}
} while (sj[0][9] < wn ); // repeat above until de Broglie's waves becomes wn
marki[2]=2; // marki[2] becomes 2 only after orbit calculation
for (int yp=0; yp <=7; yp++) {
for (int kj=0; kj <=2; kj++) {
hhpr[yp][kj]=sj[yp][kj]; ggx=sj[yp][kj]/71.428; // change to pixel
// upper and lower limits of coordinates
if (ggx > 319 && kj==0) {ggx=319; hhpr[yp][kj]=ggx*71.428; }
if (ggx > 349 && kj==1) {ggx=349; hhpr[yp][kj]=ggx*71.428;}
if (ggx > 349 && kj==2) {ggx=349; hhpr[yp][kj]=ggx*71.428;}
if (ggx < 1) {ggx=1; hhpr[yp][kj]=ggx*71.428;}
yk=(int)(100.0*(hhpr[yp][kj]-nux[kj])); gx=yk/100.0; // calculate to two decimal places
elp[yp][kj].setText(Double.toString(gx)); // show relative coordinates
ggx=Math.sqrt(sj[yp][3]*sj[yp][3]+sj[yp][4]*sj[yp][4]+sj[yp][5]*sj[yp][5]);
ggy=(1000*sj[yp][kj+3])/ggx; ex=(int)ggy; hhpr[yp][kj+4]=ggy;
elp[yp][kj+4].setText(Double.toString((double)ex)); // show each component of velocity
}
ggz=Math.sqrt((hhpr[yp][0]-nux[0])*(hhpr[yp][0]-nux[0])+
(hhpr[yp][1]-nux[1])*(hhpr[yp][1]-nux[1])+(hhpr[yp][2]-nux[2])*(hhpr[yp][2]-nux[2]));
hhpr[yp][3]=ggz;
ex=(int)(ggz*100.0); ggx=ex/100.0; // calculate to two decimal place
elp[yp][3].setText(Double.toString(ggx)); // show distance between nucleus and electron
}
} // if (mark[0]==1) end
if (marki[2] != 2 || marki[0]==1 ) { // show each particle on the screen
for (int yp=0; yp <=7; yp++) {
pota=Math.sqrt(60)*4.25; // velocity line length (pixel)
potb=Math.sqrt(hhpr[yp][4]*hhpr[yp][4]+hhpr[yp][5]*hhpr[yp][5]+hhpr[yp][6]*hhpr[yp][6]) ;
// qpp[][0-2]=each component of velocity for print
ggx=(pota*hhpr[yp][4])/potb; qpp[yp][0]=(int)ggx;
ggx=(pota*hhpr[yp][5])/potb; qpp[yp][1]=(int)ggx;
ggx=(pota*hhpr[yp][6])/potb; qpp[yp][2]=(int)ggx;
}
int nmx[]=new int[3]; int hpk[][]=new int[8][4];
for (int kj=0; kj <=2; kj++) {
nmx[kj]=(int)(nux[kj]/71.428); // change to pixel in nucleus coordinate
}
for (int yp=0; yp <=7; yp++) {
for (int kj=0; kj <=2; kj++) { // change to pixel in electron coordinate
hpk[yp][kj]=(int)(hhpr[yp][kj]/71.428);
}}
g.clearRect(9,299,1170,699);
g.setColor(Color.cyan); g.drawLine(345,310,345,660); g.drawLine(675,310,675,660);
g.setColor(Color.lightGray); // show Ne nucleus on x-y, x-z, y-z planes
g.fillOval(nmx[0]+10,650-nmx[1],20,20);g.fillOval(340+nmx[0],650-nmx[2],20,20);
g.fillOval(670+nmx[1],650-nmx[2],20,20);
// show particle and velocity vector of electron 0
g.setColor(Color.white);
g.fillOval(hpk[0][0]+13,653-hpk[0][1],14,14);
g.fillOval(hpk[0][0]+343,653-hpk[0][2],14,14);
g.fillOval(hpk[0][1]+673,653-hpk[0][2],14,14);
g.drawLine(hpk[0][0]+20,660-hpk[0][1], hpk[0][0]+20+qpp[0][0],660-hpk[0][1]-qpp[0][1]);
g.drawLine(hpk[0][0]+350,660-hpk[0][2], hpk[0][0]+350+qpp[0][0],660-hpk[0][2]-qpp[0][2]);
g.drawLine(hpk[0][1]+680,660-hpk[0][2],hpk[0][1]+680+qpp[0][1],660-hpk[0][2]-qpp[0][2]);
// show electron 1
g.fillOval(hpk[1][0]+13,653-hpk[1][1],14,14);
g.fillOval(hpk[1][0]+343,653-hpk[1][2],14,14);
g.fillOval(hpk[1][1]+673,653-hpk[1][2],14,14);
g.drawLine(hpk[1][0]+20,660-hpk[1][1], hpk[1][0]+20+qpp[1][0],660-hpk[1][1]-qpp[1][1]);
g.drawLine(hpk[1][0]+350,660-hpk[1][2], hpk[1][0]+350+qpp[1][0],660-hpk[1][2]-qpp[1][2]);
g.drawLine(hpk[1][1]+680,660-hpk[1][2],hpk[1][1]+680+qpp[1][1],660-hpk[1][2]-qpp[1][2]);
// show electron 2
g.setColor(Color.red);
g.fillOval(hpk[2][0]+13,653-hpk[2][1],14,14);
g.fillOval(hpk[2][0]+343,653-hpk[2][2],14,14);
g.fillOval(hpk[2][1]+673,653-hpk[2][2],14,14);
g.drawLine(hpk[2][0]+20,660-hpk[2][1], hpk[2][0]+20+qpp[2][0],660-hpk[2][1]-qpp[2][1]);
g.drawLine(hpk[2][0]+350,660-hpk[2][2], hpk[2][0]+350+qpp[2][0],660-hpk[2][2]-qpp[2][2]);
g.drawLine(hpk[2][1]+680,660-hpk[2][2],hpk[2][1]+680+qpp[2][1],660-hpk[2][2]-qpp[2][2]);
// show electron 3
g.fillOval(hpk[3][0]+13,653-hpk[3][1],14,14);
g.fillOval(hpk[3][0]+343,653-hpk[3][2],14,14);
g.fillOval(hpk[3][1]+673,653-hpk[3][2],14,14);
g.drawLine(hpk[3][0]+20,660-hpk[3][1], hpk[3][0]+20+qpp[3][0],660-hpk[3][1]-qpp[3][1]);
g.drawLine(hpk[3][0]+350,660-hpk[3][2], hpk[3][0]+350+qpp[3][0],660-hpk[3][2]-qpp[3][2]);
g.drawLine(hpk[3][1]+680,660-hpk[3][2],hpk[3][1]+680+qpp[3][1],660-hpk[3][2]-qpp[3][2]);
// show electron 4
g.setColor(Color.green);
g.fillOval(hpk[4][0]+13,653-hpk[4][1],14,14);
g.fillOval(hpk[4][0]+343,653-hpk[4][2],14,14);
g.fillOval(hpk[4][1]+673,653-hpk[4][2],14,14);
g.drawLine(hpk[4][0]+20,660-hpk[4][1], hpk[4][0]+20+qpp[4][0],660-hpk[4][1]-qpp[4][1]);
g.drawLine(hpk[4][0]+350,660-hpk[4][2], hpk[4][0]+350+qpp[4][0],660-hpk[4][2]-qpp[4][2]);
g.drawLine(hpk[4][1]+680,660-hpk[4][2],hpk[4][1]+680+qpp[4][1],660-hpk[4][2]-qpp[4][2]);
// show electron 5
g.fillOval(hpk[5][0]+13,653-hpk[5][1],14,14);
g.fillOval(hpk[5][0]+343,653-hpk[5][2],14,14);
g.fillOval(hpk[5][1]+673,653-hpk[5][2],14,14);
g.drawLine(hpk[5][0]+20,660-hpk[5][1], hpk[5][0]+20+qpp[5][0],660-hpk[5][1]-qpp[5][1]);
g.drawLine(hpk[5][0]+350,660-hpk[5][2], hpk[5][0]+350+qpp[5][0],660-hpk[5][2]-qpp[5][2]);
g.drawLine(hpk[5][1]+680,660-hpk[5][2],hpk[5][1]+680+qpp[5][1],660-hpk[5][2]-qpp[5][2]);
// show electron 6
g.setColor(Color.yellow);
g.fillOval(hpk[6][0]+13,653-hpk[6][1],14,14);
g.fillOval(hpk[6][0]+343,653-hpk[6][2],14,14);
g.fillOval(hpk[6][1]+673,653-hpk[6][2],14,14);
g.drawLine(hpk[6][0]+20,660-hpk[6][1], hpk[6][0]+20+qpp[6][0],660-hpk[6][1]-qpp[6][1]);
g.drawLine(hpk[6][0]+350,660-hpk[6][2], hpk[6][0]+350+qpp[6][0],660-hpk[6][2]-qpp[6][2]);
g.drawLine(hpk[6][1]+680,660-hpk[6][2],hpk[6][1]+680+qpp[6][1],660-hpk[6][2]-qpp[6][2]);
// show electron 7
g.fillOval(hpk[7][0]+13,653-hpk[7][1],14,14);
g.fillOval(hpk[7][0]+343,653-hpk[7][2],14,14);
g.fillOval(hpk[7][1]+673,653-hpk[7][2],14,14);
g.drawLine(hpk[7][0]+20,660-hpk[7][1], hpk[7][0]+20+qpp[7][0],660-hpk[7][1]-qpp[7][1]);
g.drawLine(hpk[7][0]+350,660-hpk[7][2], hpk[7][0]+350+qpp[7][0],660-hpk[7][2]-qpp[7][2]);
g.drawLine(hpk[7][1]+680,660-hpk[7][2],hpk[7][1]+680+qpp[7][1],660-hpk[7][2]-qpp[7][2]);
// show each electron's number
for (int rw=0; rw <=7; rw++) {
g.setColor(Color.blue);
g.drawString(Integer.toString(rw),hpk[rw][0]+17,665-hpk[rw][1]);
g.drawString(Integer.toString(rw),hpk[rw][0]+347,665-hpk[rw][2] );
g.drawString(Integer.toString(rw),hpk[rw][1]+677,665-hpk[rw][2] );
}
marki[0]=0;
} // if (marki[2] !=2 || marki[0] =1) end
}}