CH4、H2O のページに戻る
2重結合のページに戻る
トップページ(2電子原子も含む新ボーア模型)
このプログラムは少し長いので、下に示すソースプログラムをコピーして、テキストエディタ(メモ帳など)にそのまま貼り付けて、コンパイルすれば簡単に実行できる。
このプログラムの class file name は ethane なので、このデキストエディタを "ethane.java" のファイル名で保存してコンパイルしてほしい。
あるバージョンの JAVA では、" -Xlint : unchecked..." という注意が コンパイル後に画面にでることがあるが、その警告は無視して そのままプログラムは実行できます。
このプログラムでは、原子核は灰色の円で示してある。
各粒子は、x-y (左)、x-z (右)平面に表示される。
ここでは、新しい単位として ( 1 MM = 10-14 meter) を使っている。
テキストボックス内の電子の各座標 (+X (MM), +Y (MM), +Z (MM)) は、これらの原子核からの”相対的な”位置座標を示している。
(ele 0-3 は炭素原子核 (C0) からの、 ele 4-7 は 炭素原子核 (C1) からの、ele8 は水素原子核 (H0) からの、ele9 は H1 からの、ele10 は H2 からの、ele11 は H3 からの、ele12 は H4 からの、ele13 は H5 からの相対座標である。)
電子 (ele 0,1,4,7,8,11) のみの座標 (+X, +Y, +Z) を自由に変更することができる。
(ele0,1,4,7,8,11) のテキストボックス内に値を入力して、Enter キーを押せばいい。他の粒子はそれをもとに変更される。)
"nuc (MM)" はこれらの核と電子の距離である。
V (eV) と T (eV) は各電子の位置エネルギーと運動エネルギーを示している。
tV (eV) は全位置エネルギーである。
ele 0-7 の CF は、中心方向への力を意味し、ele 8-13 のCF は 各 C-H line 方向への力(= C-H line に垂直な力)を意味する。
(fx, fy, fz) は CF を除いた残りの力の成分を意味する。
(FX, FY, FZ) は各原子核に作用する力の成分を意味する。
CnH0, CnH3 は H0,H3水素原子核に作用する、C 核方向への力の成分を意味する。
(このプログラムでは、4つの原子核 (C0, C1, H0, H3) の情報のみ示される。)
Waves (wn) は1軌道に含まれるド。ブロイ波の数を示している。
スクロールバーの中から値を選択して、C-C (MM) ボタンをクリックすれば、エタンの C-C長が変化する。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Scanner;
public class ethane extends JPanel // virial theorem of ethane (H3C-CH3)
{
public static void main(String arg[])
{
JFrame frame = new JFrame("CH3-CH3 (ethane)");
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 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 suh=5200.0*5200.0; // suh=(Bohr radius)^2
JTextField elp[][]=new JTextField[9][11]; JTextField impho=new JTextField(7);
JTextField mmpho[][]=new JTextField[4][3]; JTextField imppo=new JTextField(7);
JTextField imppp=new JTextField(7);
JButton b1=new JButton("C-C (MM)");
String ope[]={"13500","14000","15351","16500"}; // scrollbar of C-C distances
JComboBox coom=new JComboBox(ope);
double rtw=Math.sqrt(2); double rth=Math.sqrt(3);
double rsi=Math.sqrt(6); double rfi=Math.sqrt(5);
double hpr[][]=new double[14][11]; double hpr2[][]=new double[14][3];
double den=4.217; // den = central charge
double cclen=15351.0; // cclen= C-C length (MM)
double angl=111.17; // angl = C-C-H angle
double chlen=10940.0; // chlen = C-H length (MM)
double cc2=chlen*Math.sin(angl*pai/180.0);
double cc3=-chlen*Math.cos(angl*pai/180.0);
double cc4=cc2*0.5; double cc5=cc4*rth;
// nux[0-7][0-2] = nuclear coordinate : 0=C0, 1=C1, 2=H0, 3=H1, 4=H2, 5=H3, 6=H4, 7=H5
double nux[][]={{18571.28+cclen*0.5, 13214.18, 13214.18, den},
{18571.28-cclen*0.5, 13214.18, 13214.18, den},
{18571.28+cclen*0.5+cc3, 13214.18+cc2, 13214.18, 1.0},
{18571.28+cclen*0.5+cc3, 13214.18-cc4, 13214.18-cc5, 1.0},
{18571.28+cclen*0.5+cc3, 13214.18-cc4, 13214.18+cc5, 1.0},
{18571.28-cclen*0.5-cc3, 13214.18-cc2, 13214.18, 1.0},
{18571.28-cclen*0.5-cc3, 13214.18+cc4, 13214.18-cc5, 1.0},
{18571.28-cclen*0.5-cc3, 13214.18+cc4, 13214.18+cc5, 1.0} };
// te1[][]=control condition C-C=15351 MM
double te1[][]={{-6285, 0, 0}, {+2305, 6019, 0},
{+2235, 6045, 0}, {+2235, -3022, -5235},
{+2235, -3022, 5235}, {-6360, 0, 0}, {+1800, 1825, -3705},
{1800, 2296, 3432}, {800, 1975, 3900}};
double te2[][]={{-6300, 0, 0}, {+2315, 6020, 0}, // te2[][]= C-C=16500 MM
{+2290, 6050, 0}, {2290, -3025, -5239},
{+2290, -3024, 5239}, {-6380, 0, 0}, {+1900, 1600, -3750},
{1900, 2447, 3260}, {800, 1876, 4110}};
double te3[][]={{-6190, 0, 0}, {+2350, 6070, 0}, // te3[][]= C-C=14000 MM
{+2235, 6100, 0}, {2235, -3050, -5282},
{+2235, -3049, 5282}, {-6280, 0, 0}, {+1800, 1825, -3705},
{1800, 2296, 3432}, {800, 1945, 3800}};
double te4[][]={{-6180, 0, 0}, {+2305, 6095, 0}, // te4[][]= C-C=13500 MM
{+2200, 6200, 0}, {2200, -3100, -5369},
{+2200, -3099, 5369}, {-6300, 0, 0}, {1800, 1850, -3680},
{1800, 2261, 3442}, {850, 1980, 3840}};
public J2DPanel()
{
setBackground(Color.black);
JPanel p=new JPanel();
p.setLayout(new GridLayout(12,12));
int aaa=0;
// elp[el=0-8][] : textboxes of electrons 0,1,4,5,6,7,8,10,11
for (int el=0; el <= 8; el++) {
for (int pos=0; pos <= 2; pos++) {
elp[el][pos]=new JTextField(7);
if (el < 3) {elp[el][pos].addActionListener(this);}
if (el== 5 || el==6) {elp[el][pos].addActionListener(this);}
if (el == 8) {elp[el][pos].addActionListener(this);}
}}
for (int el=0; el <= 8; el++) {
for (int pos=3; pos <= 10; pos++) {
elp[el][pos]=new JTextField(7);
}}
// mmpho[0-3][] = textboxes of nuclei C0, C1, H0, H3
for (int el=0; el <= 3; el++) {
for (int pos=0; pos <= 2; pos++) {
mmpho[el][pos]=new JTextField(7);
}}
// layout
String sihy[]={"eNo ", "+X(MM)", "+Y(MM)", "+Z(MM)", "nuc(MM)",
"V(eV)", "T(eV)", "Force", "fx ", "fy", "fz", "Waves"};
for (int el=0; el <= 11; el++) {
p.add(new Label(sihy[el]));
}
String yy;
for (int el=0; el <= 8; el++) {
yy=" ";
if (el < 2) {yy="ele "; aaa=el;}
if (el == 2) {yy="ele "; aaa=4;}
if (el > 2 && el < 5) {yy=" "; aaa=el+2;}
if (el == 5 || el==6) {yy="ele "; aaa=el+2;}
if (el == 7) {yy=" "; aaa=10;}
if (el == 8) {yy="ele "; aaa=11;}
p.add(new Label(yy+aaa+" "));
for (int pos=0; pos <= 10; pos++) {
p.add(elp[el][pos]);
}}
p.add(new Label("C0 nuc "));
for (int pos=0; pos <= 2; pos++) {
p.add(mmpho[0][pos]);
}
p.add(new Label(" -- ")); p.add(impho);
p.add(new Label("C1 nuc "));
for (int pos=0; pos <= 2; pos++) {
p.add(mmpho[1][pos]);
}
p.add(new Label(" -- ")); p.add(new Label(" -- "));
p.add(new Label("H0nuc "));
for (int pos=0; pos <= 2; pos++) {
p.add(mmpho[2][pos]);
} p.add(imppo);
p.add(new Label("H3nuc "));
for (int pos=0; pos <= 2; pos++) {
p.add(mmpho[3][pos]);
} p.add(imppp);
p.add(b1); p.add(coom); coom.setSelectedItem("15351"); b1.addActionListener(this);
add(p,"South");
for (int el=0; el <= 8; el++) {
double nnuc=Math.sqrt(te1[el][0]*te1[el][0]+te1[el][1]*te1[el][1]+te1[el][2]*te1[el][2]);
aaa=(int)(nnuc);
elp[el][3].setText(Integer.toString(aaa));
// hpr[0-13][0-2] = coordinate of each electron (0-14)
for (int jou=0; jou <= 2; jou++) {
if (el < 2) {hpr[el][jou]=te1[el][jou]+nux[0][jou];}
if (el > 1 && el < 6) {hpr[el+2][jou]=te1[el][jou]+nux[1][jou];}
if (el==6) {hpr[8][jou]=te1[6][jou]+nux[2][jou];
hpr[9][jou]=te1[6][jou]+nux[3][jou];}
if (el==7) { hpr[10][jou]=te1[7][jou]+nux[4][jou];}
if (el==8) { hpr[11][jou]=te1[8][jou]+nux[5][jou];}
elp[el][jou].setText(Integer.toString((int)(te1[el][jou])));
}}
} // public J2DPanel() end
public void actionPerformed(ActionEvent e) {
String ss; double Rf=0.0;
if (e.getSource() == b1) { // when C-C distance change (b1 click)
ss=(String)coom.getSelectedItem();
if (ss=="13500") {cclen=13500;} if (ss=="14000") {cclen=14000; }
if (ss=="15351") {cclen=15351;} if (ss=="16500") {cclen=16500; }
double nuxx[][]={{18571.28+cclen*0.5, 13214.18, 13214.18},
{18571.28-cclen*0.5, 13214.18, 13214.18},
{18571.28+cclen*0.5+cc3, 13214.18+cc2, 13214.18},
{18571.28+cclen*0.5+cc3, 13214.18-cc4, 13214.18-cc5},
{18571.28+cclen*0.5+cc3, 13214.18-cc4, 13214.18+cc5},
{18571.28-cclen*0.5-cc3, 13214.18-cc2, 13214.18},
{18571.28-cclen*0.5-cc3, 13214.18+cc4, 13214.18-cc5},
{18571.28-cclen*0.5-cc3, 13214.18+cc4, 13214.18+cc5} };
for (int ett=0; ett <= 7; ett++) {
for (int sws=0; sws <=2; sws++) {
nux[ett][sws]=nuxx[ett][sws];
}}
for (int ett=0; ett <= 8; ett++) {
for (int sws=0; sws <= 2; sws++) {
if (cclen==13500) {Rf=te4[ett][sws];} if (cclen==14000) {Rf=te3[ett][sws];}
if (cclen==15351) {Rf=te1[ett][sws];} if (cclen==16500) {Rf=te2[ett][sws];}
elp[ett][sws].setText(Integer.toString((int)Rf));
}}
}
repaint();
}
public void update(Graphics g)
{
paint(g);
}
public void paintComponent(Graphics g)
{
double kro,krr,krk,kro2,krr2,krk2,kkk,kkk2, pot,pota,potb,
pot2,pota2,potb2,potc,potc2,gx,gy,gz,ggx,ggy,ggz,ttav,toav;
kro=0.0; krr=0.0; krk=0.0; kro2=0.0; krr2=0.0; krk2=0.0; kkk=0.0; kkk2=0.0;
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,0,0},{0,0,0,0,0,0},
{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},
{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0}};
double rpp[][]= {{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
double mmp[][]={{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};
double teqq[][]={{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},
{0,0,0,0},{0,0,0,0},{0,0,0,0}};
double noxx[][]={{0,0,0,0},{0,0,0,0}}; double vv[]={0,0};
double cor=Math.cos(120.0*pai/180.0); double sor=Math.sin(120.0*pai/180.0);
double crr=Math.cos(240.0*pai/180.0); double srr=Math.sin(240.0*pai/180.0);
// set electrons 0 (elp[0][0-2]), and 1 (elp[1][0-2]) coordinates
for (int yp=0; yp <= 1; yp++) {
for (int jou=0; jou <= 2; jou++) {
ww=elp[yp][jou].getText(); gx=Double.parseDouble(ww);
hpr[yp][jou]=gx;
}} // calculate electrons 2, 3 rotating electron 1's coordinate
hpr[2][0]=hpr[1][0]; hpr[3][0]=hpr[1][0];
hpr[3][1]=cor*hpr[1][1]-sor*hpr[1][2]; hpr[3][2]=sor*hpr[1][1]+cor*hpr[1][2];
hpr[2][1]=crr*hpr[1][1]-srr*hpr[1][2]; hpr[2][2]=srr*hpr[1][1]+crr*hpr[1][2];
// hpr[0-13][0-2] = absolute coordinate of electrons 0-13
for (int yp=0; yp <= 3; yp++) {
for (int jou=0; jou <= 2; jou++) {
hpr[yp][jou]=hpr[yp][jou]+nux[0][jou];
}}
// set electrons 4 (elp[2][0-2]), and 7 (elp[5][0-2]) coordinates
for (int jou=0; jou <= 2; jou++) {
ww=elp[2][jou].getText(); gx=Double.parseDouble(ww); hpr[4][jou]=gx;
ww=elp[5][jou].getText(); gx=Double.parseDouble(ww); hpr[7][jou]=gx;
}
// calculate electrons 5,6 rotating electron 4 's coordinate
hpr[5][0]=hpr[4][0]; hpr[6][0]=hpr[4][0];
hpr[6][1]=cor*hpr[4][1]-sor*hpr[4][2]; hpr[6][2]=sor*hpr[4][1]+cor*hpr[4][2];
hpr[5][1]=crr*hpr[4][1]-srr*hpr[4][2]; hpr[5][2]=srr*hpr[4][1]+crr*hpr[4][2];
for (int yp=4; yp <= 7; yp++) {
for (int jou=0; jou <= 2; jou++) {
if (yp==5 || yp==6) {elp[yp-2][jou].setText(Integer.toString((int)hpr[yp][jou]));}
hpr[yp][jou]=hpr[yp][jou]+nux[1][jou];
}}
// set electron 8 coordinate =elp[6][0-2]
for (int jou=0; jou <= 2; jou++) {
ww=elp[6][jou].getText(); gx=Double.parseDouble(ww);
hpr[8][jou]=gx;
}
// calculate electrons 9,10 rotating electron 8' s coordinate
hpr[9][0]=hpr[8][0]; hpr[10][0]=hpr[8][0];
hpr[10][1]=cor*hpr[8][1]-sor*hpr[8][2]; hpr[10][2]=sor*hpr[8][1]+cor*hpr[8][2];
hpr[9][1]=crr*hpr[8][1]-srr*hpr[8][2]; hpr[9][2]=srr*hpr[8][1]+crr*hpr[8][2];
for (int yp=8; yp <= 10; yp++) {
for (int jou=0; jou <= 2; jou++) {
if (yp==10) {elp[7][jou].setText(Integer.toString((int)hpr[yp][jou]));}
hpr[yp][jou]=hpr[yp][jou]+nux[yp-6][jou];
}}
// set electron 11 coordinate =elp[8][0-2]
for (int jou=0; jou <= 2; jou++) {
ww=elp[8][jou].getText(); gx=Double.parseDouble(ww);
hpr[11][jou]=gx;
}
// calculate electrons 12,13 rotating electron 11' s coordinate
hpr[12][0]=hpr[11][0]; hpr[13][0]=hpr[11][0];
hpr[12][1]=cor*hpr[11][1]-sor*hpr[11][2]; hpr[12][2]=sor*hpr[11][1]+cor*hpr[11][2];
hpr[13][1]=crr*hpr[11][1]-srr*hpr[11][2]; hpr[13][2]=srr*hpr[11][1]+crr*hpr[11][2];
for (int yp=11; yp <= 13; yp++) {
for (int jou=0; jou <= 2; jou++) {
hpr[yp][jou]=hpr[yp][jou]+nux[yp-6][jou];
}}
// noxx[0][0-2]=center of electrons 0-3
// noxx[1][0-2]=center of electrons 4-7
for (int yp=0; yp <= 3; yp++) {
for (int jou=0; jou <= 2; jou++) {
noxx[0][jou]=noxx[0][jou]+hpr[yp][jou];
noxx[1][jou]=noxx[1][jou]+hpr[yp+4][jou];
}}
for (int jou=0; jou <= 2; jou++) {
noxx[0][jou]=noxx[0][jou]/4.0; noxx[1][jou]=noxx[1][jou]/4.0;
}
// calculate hpr2[8-13][0-2]= symmetric positions of ele 8-13 with respect to C-H lines
for (int yp=8; yp <= 10; yp++) {
gx=nux[yp-6][0]-nux[0][0]; gy=nux[yp-6][1]-nux[0][1]; gz=nux[yp-6][2]-nux[0][2];
pot=Math.sqrt(gx*gx+gy*gy+gz*gz);
// pota = inner product
pota=((hpr[yp][0]-nux[0][0])*gx+(hpr[yp][1]-nux[0][1])*gy+(hpr[yp][2]-nux[0][2])*gz)/pot;
for (int jou=0; jou <= 2; jou++) {
ggy=((nux[yp-6][jou]-nux[0][jou])*pota)/pot;
ggz=ggy-(hpr[yp][jou]-nux[0][jou]);
hpr2[yp][jou]=hpr[yp][jou]+2*ggz;
}}
for (int yp=11; yp <= 13; yp++) {
gx=nux[yp-6][0]-nux[1][0]; gy=nux[yp-6][1]-nux[1][1]; gz=nux[yp-6][2]-nux[1][2];
pot=Math.sqrt(gx*gx+gy*gy+gz*gz);
// pota = inner product
pota=((hpr[yp][0]-nux[1][0])*gx+(hpr[yp][1]-nux[1][1])*gy+(hpr[yp][2]-nux[1][2])*gz)/pot;
for (int jou=0; jou <=2; jou++) {
ggy=((nux[yp-6][jou]-nux[1][jou])*pota)/pot;
ggz=ggy-(hpr[yp][jou]-nux[1][jou]);
hpr2[yp][jou]=hpr[yp][jou]+2*ggz;
}}
toav=0.0; // toav=total potential energy (eV)
double ppot;
//-------------------- interaction among electrons 0-3, (and among 4-7)
for (int yp=0; yp <= 3; yp++) {
for (int kj=0; kj <= 3; kj++) {
if (yp < kj ) { // kro =distance between electrons 0-3
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;}
// kro2 =distance between electrons 4-7
kro2=Math.sqrt((hpr[yp+4][0]-hpr[kj+4][0])*(hpr[yp+4][0]-hpr[kj+4][0])+
(hpr[yp+4][1]-hpr[kj+4][1])*(hpr[yp+4][1]-hpr[kj+4][1])+
(hpr[yp+4][2]-hpr[kj+4][2])*(hpr[yp+4][2]-hpr[kj+4][2]));
if (kro2==0) {kro2=5000.0;}
ppot=(elc*elc*6.241509e18)/(4*pai*epsi*kro*1.0e-14); // potential energy (eV)
potb=(elc*elc*6.241509e18)/(4*pai*epsi*kro2*1.0e-14);
toav=toav+ppot+potb;
// rhp[el][3] = each electron's V (eV)
// teqq[el][3] = each electron's V (eV) only in carbon atom
rhp[yp][3]=rhp[yp][3]+ppot/2.0; rhp[kj][3]=rhp[kj][3]+ppot/2.0;
teqq[yp][3]=teqq[yp][3]+ppot/2; teqq[kj][3]=teqq[kj][3]+ppot/2;
rhp[yp+4][3]=rhp[yp+4][3]+potb/2.0; rhp[kj+4][3]=rhp[kj+4][3]+potb/2.0;
teqq[yp+4][3]=teqq[yp+4][3]+potb/2; teqq[kj+4][3]=teqq[kj+4][3]+potb/2;
for (int jou=0; jou <= 2; jou++) {
// ggx=force components between electrons
// rhp[el][0-2]=force components acting on each electron
// teqq[el][0-2]=force components acting on electron only in carbon atom
ggx=(suh*(hpr[yp][jou]-hpr[kj][jou]))/(kro*kro*kro);
rhp[yp][jou]=rhp[yp][jou]+ggx; rhp[kj][jou]=rhp[kj][jou]-ggx;
teqq[yp][jou]=teqq[yp][jou]+ggx; teqq[kj][jou]=teqq[kj][jou]-ggx;
ggy=(suh*(hpr[yp+4][jou]-hpr[kj+4][jou]))/(kro2*kro2*kro2);
rhp[yp+4][jou]=rhp[yp+4][jou]+ggy; rhp[kj+4][jou]=rhp[kj+4][jou]-ggy;
teqq[yp+4][jou]=teqq[yp+4][jou]+ggy; teqq[kj+4][jou]=teqq[kj+4][jou]-ggy;
}
}}}
//------------------------ interaction between ele (0-3) x ele (4-7)
for (int yp=0; yp <= 3; yp++) {
for (int kj=4; kj <= 7; kj++) {
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=(elc*elc*6.241509e18)/(4*pai*epsi*kro*1.0e-14); // potential energy (eV)
rhp[yp][3]=rhp[yp][3]+pot/2.0; rhp[kj][3]=rhp[kj][3]+pot/2.0;
toav=toav+pot;
for (int jou=0; jou <=2; jou++) {
ggx=(suh*(hpr[yp][jou]-hpr[kj][jou]))/(kro*kro*kro);
rhp[yp][jou]=rhp[yp][jou]+ggx; rhp[kj][jou]=rhp[kj][jou]-ggx;
// rpp[0-7][0-2] = the total force from other nuclei's electrons and 8 nuclei
rpp[yp][jou]=rpp[yp][jou]+ggx; rpp[kj][jou]=rpp[kj][jou]-ggx;
}
}}
//------------------ interaction between ele (0-3) (and 4-7)x other ele (8-13)
for (int yp=0; yp <=3; yp++) {
for (int kj=8; kj <=13; kj++) {
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;}
// kro2 = distance between electron (0-3) and hpr2[8-13][]
kro2=Math.sqrt((hpr[yp][0]-hpr2[kj][0])*(hpr[yp][0]-hpr2[kj][0])+
(hpr[yp][1]-hpr2[kj][1])*(hpr[yp][1]-hpr2[kj][1])+
(hpr[yp][2]-hpr2[kj][2])*(hpr[yp][2]-hpr2[kj][2]));
if (kro2==0) {kro2=5000.0;}
krr=Math.sqrt((hpr[yp+4][0]-hpr[kj][0])*(hpr[yp+4][0]-hpr[kj][0])+
(hpr[yp+4][1]-hpr[kj][1])*(hpr[yp+4][1]-hpr[kj][1])+
(hpr[yp+4][2]-hpr[kj][2])*(hpr[yp+4][2]-hpr[kj][2]));
if (krr==0) {krr=5000.0;}
// krr2 = distance between electron (4-7) and hpr2[8-13][]
krr2=Math.sqrt((hpr[yp+4][0]-hpr2[kj][0])*(hpr[yp+4][0]-hpr2[kj][0])+
(hpr[yp+4][1]-hpr2[kj][1])*(hpr[yp+4][1]-hpr2[kj][1])+
(hpr[yp+4][2]-hpr2[kj][2])*(hpr[yp+4][2]-hpr2[kj][2]));
if (krr2==0) {krr2=5000.0;}
pot=(elc*elc*6.241509e18)/(4*pai*epsi*kro*1.0e-14); // potential energy (eV)
pot2=(elc*elc*6.241509e18)/(4*pai*epsi*kro2*1.0e-14);
rhp[yp][3]=rhp[yp][3]+pot/4.0+pot2/4.0; rhp[kj][3]=rhp[kj][3]+pot/2.0;
pota=(elc*elc*6.241509e18)/(4*pai*epsi*krr*1.0e-14);
pota2=(elc*elc*6.241509e18)/(4*pai*epsi*krr2*1.0e-14);
rhp[yp+4][3]=rhp[yp+4][3]+pota/4.0+pota2/4.0; rhp[kj][3]=rhp[kj][3]+pota/2.0;
toav=toav+pot+pota;
for (int jou=0; jou <=2; jou++) {
ggx=(suh*(hpr[yp][jou]-hpr[kj][jou]))/(kro*kro*kro);
ggy=(suh*(hpr[yp][jou]-hpr2[kj][jou]))/(kro2*kro2*kro2);
rhp[yp][jou]=rhp[yp][jou]+ggx*0.5+ggy*0.5; rhp[kj][jou]=rhp[kj][jou]-ggx;
// rpp[0-7][0-2] = the total force from other nuclei's electrons and 8 nuclei
rpp[yp][jou]=rpp[yp][jou]+ggx*0.5+ggy*0.5;
ggx=(suh*(hpr[yp+4][jou]-hpr[kj][jou]))/(krr*krr*krr);
ggy=(suh*(hpr[yp+4][jou]-hpr2[kj][jou]))/(krr2*krr2*krr2);
rhp[yp+4][jou]=rhp[yp+4][jou]+ggx; rhp[kj][jou]=rhp[kj][jou]-ggx;
rpp[yp+4][jou]=rpp[yp+4][jou]+ggx;
}
}}
//----------------------------- interaction among ele (8-13)
for (int yp=8; yp <=13; yp++) {
for (int kj=8; kj <=13; kj++) {
if (yp > kj) {
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=(elc*elc*6.241509e18)/(4*pai*epsi*kro*1.0e-14); //potential energy (eV)
rhp[yp][3]=rhp[yp][3]+pot/2.0; rhp[kj][3]=rhp[kj][3]+pot/2.0;
toav=toav+pot;
for (int jou=0; jou <=2; jou++) {
ggx=(suh*(hpr[yp][jou]-hpr[kj][jou]))/(kro*kro*kro);
rhp[yp][jou]=rhp[yp][jou]+ggx; rhp[kj][jou]=rhp[kj][jou]-ggx;
}
}}}
//-------------------- interaction between noxx and ele0-3 (and ele 4-7)
for (int rv=0; rv <=3; rv++) {
// kro=distance between electrons 0-3 and noxx[0][]
kro=Math.sqrt((hpr[rv][0]-noxx[0][0])*(hpr[rv][0]-noxx[0][0])+
(hpr[rv][1]-noxx[0][1])*(hpr[rv][1]-noxx[0][1])+
(hpr[rv][2]-noxx[0][2])*(hpr[rv][2]-noxx[0][2]));
if (kro == 0) {kro=5000.0;}
// kro2=distance between electrons 4-7 and noxx[1][]
kro2=Math.sqrt((hpr[rv+4][0]-noxx[1][0])*(hpr[rv+4][0]-noxx[1][0])+
(hpr[rv+4][1]-noxx[1][1])*(hpr[rv+4][1]-noxx[1][1])+
(hpr[rv+4][2]-noxx[1][2])*(hpr[rv+4][2]-noxx[1][2]));
if (kro2 == 0) {kro2=5000.0;}
ppot=(elc*elc*den*6.241509e18)/(4*pai*epsi*kro*1.0e-14);
teqq[rv][3]=teqq[rv][3]-ppot; // teqq[0-3][3]=potential energy only in carbon 0 atom
potb=(elc*elc*den*6.241509e18)/(4*pai*epsi*kro2*1.0e-14);
teqq[rv+4][3]=teqq[rv+4][3]-potb; // teqq[4-7][3]=potential energy only in carbon 1 atom
for (int jou=0; jou <=2; jou++) {
ggx=(suh*den*(hpr[rv][jou]-noxx[0][jou]))/(kro*kro*kro);
ggy=(suh*den*(hpr[rv+4][jou]-noxx[1][jou]))/(kro2*kro2*kro2);
// teqq[][0-2]=force components only in carbon atom
teqq[rv][jou]=teqq[rv][jou]-ggx; teqq[rv+4][jou]=teqq[rv+4][jou]-ggy;
}}
// interaction between electrons and nuclei
for (int rv=0; rv <=13; rv++) {
// ---------------- C 0,1 nuclei
for (int yp=0; yp <=1; yp++) {
kro=Math.sqrt((hpr[rv][0]-nux[yp][0])*(hpr[rv][0]-nux[yp][0])+
(hpr[rv][1]-nux[yp][1])*(hpr[rv][1]-nux[yp][1])+
(hpr[rv][2]-nux[yp][2])*(hpr[rv][2]-nux[yp][2])); kro2=1000.0;
if (kro == 0) {kro=5000.0;}
// kro2=distance between hpr2[8-13][0-2] and C nucleus
if (rv > 7) {kro2=Math.sqrt((hpr2[rv][0]-nux[yp][0])*(hpr2[rv][0]-nux[yp][0])+
(hpr2[rv][1]-nux[yp][1])*(hpr2[rv][1]-nux[yp][1])+
(hpr2[rv][2]-nux[yp][2])*(hpr2[rv][2]-nux[yp][2]));
if (kro2 == 0) {kro2=5000.0;}
}
pot =-den/kro;
ttav= (elc*elc*6.241509e18*pot)/(4*pai*epsi*1.0e-14); // ttav=potential energy (eV)
rhp[rv][3]=rhp[rv][3]+ttav; toav=toav+ttav; gx=0;
if (rv < 4 && yp==0) {ex=(int)(kro); gx=1;
// show distance between electrons 0,1 and C0 nucleus
if (rv < 2) {elp[rv][3].setText("nuc "+Integer.toString(ex)); }
}
if (rv > 3 && rv < 8) {
if (yp==1) {ex=(int)(kro); gx=2;
// show distance between electrons 4-7 and C1 nucleus
elp[rv-2][3].setText("nuc "+Integer.toString(ex)); }
}
// rhp[rv][5]=interaction between each electron and other nuclei
if (gx==0) {rhp[rv][5]=rhp[rv][5]+pot;}
for (int kj=0; kj <=2; kj++) {
// ggx (ggy) = force component between C nucleus and each electron
ggx=(suh*den*(hpr[rv][kj]-nux[yp][kj]))/(kro*kro*kro); ggy=ggx;
if (rv > 7) {ggy=(suh*den*(hpr2[rv][kj]-nux[yp][kj]))/(kro2*kro2*kro2);}
// mmp[0-1][0-2]=force component acting on C0,1nuclei
mmp[yp][kj]=mmp[yp][kj]+ggx; rhp[rv][kj]=rhp[rv][kj]-ggx;
// rpp[0-7][0-2] = the total force from other nuclei's electrons and 8 nuclei
if (rv < 8) {rpp[rv][kj]=rpp[rv][kj]-ggx;}
}
}
// ----------------------------- H nuclei (nux[2-7][])
for (int yp=2; yp <=7; yp++) {
krr=Math.sqrt((hpr[rv][0]-nux[yp][0])*(hpr[rv][0]-nux[yp][0])+
(hpr[rv][1]-nux[yp][1])*(hpr[rv][1]-nux[yp][1])+
(hpr[rv][2]-nux[yp][2])*(hpr[rv][2]-nux[yp][2])); krr2=1000.0;
if (krr ==0) {krr=5000.0;}
if (rv > 7) {krr2=Math.sqrt((hpr2[rv][0]-nux[yp][0])*(hpr2[rv][0]-nux[yp][0])+
(hpr2[rv][1]-nux[yp][1])*(hpr2[rv][1]-nux[yp][1])+
(hpr2[rv][2]-nux[yp][2])*(hpr2[rv][2]-nux[yp][2]));
if (krr2 == 0) {krr2=5000.0;}
}
pota=-1.0/krr;
ttav= (elc*elc*6.241509e18*pota)/(4*pai*epsi*1.0e-14); // ttav=potential energy (eV)
rhp[rv][3]=rhp[rv][3]+ttav; toav=toav+ttav;
if (rv==yp+6) {ex=(int)(krr);
// show distance between electron (8,10,11) and nucleus (H0,H2,H3)
if (rv==8) { elp[6][3].setText("nuc "+Integer.toString(ex));}
if (rv==10 || rv==11) { elp[rv-3][3].setText("nuc "+Integer.toString(ex));}
}
// rhp[rv][5]=interaction between each electron and other nuclei
if (rv != yp+6) {rhp[rv][5]=rhp[rv][5]+pota;}
for (int kj=0; kj <=2; kj++) {
ggx=(suh*(hpr[rv][kj]-nux[yp][kj]))/(krr*krr*krr); ggy=ggx;
if (rv > 7) {ggy=(suh*(hpr2[rv][kj]-nux[yp][kj]))/(krr2*krr2*krr2);}
// mmp[2,3][0-2]=force component acting on H0, H3 nuclei
if (yp == 2) {mmp[2][kj]=mmp[2][kj]+ggx/2.0+ggy/2.0;}
if (yp == 5) {mmp[3][kj]=mmp[3][kj]+ggx/2.0+ggy/2.0;}
rhp[rv][kj]=rhp[rv][kj]-ggx;
if (rv < 8) {rpp[rv][kj]=rpp[rv][kj]-ggx;}
}
}
}
potc=0.0;
for (int rv=0; rv <=7; rv++) { // interaction among 8 nuclei
for (int el=0; el <=7; el++) {
if (rv > el) {
kro=Math.sqrt((nux[rv][0]-nux[el][0])*(nux[rv][0]-nux[el][0])+
(nux[rv][1]-nux[el][1])*(nux[rv][1]-nux[el][1])+
(nux[rv][2]-nux[el][2])*(nux[rv][2]-nux[el][2]));
ttav=(elc*elc*6.241509e18*nux[rv][3]*nux[el][3])/(4*pai*epsi*kro*1.0e-14);
toav=toav+ttav; potc=potc+ttav; // potc=the sum of potential energy among 8 nuclei
for (int jou=0; jou <=2; jou++) {
ggx=(suh*nux[rv][3]*nux[el][3]*(nux[rv][jou]-nux[el][jou]))/(kro*kro*kro);
if (rv < 3) {mmp[rv][jou]=mmp[rv][jou]+ggx;}
if (rv == 5) {mmp[3][jou]=mmp[3][jou]+ggx;}
if (el < 3) {mmp[el][jou]=mmp[el][jou]-ggx;}
if (el == 5) {mmp[3][jou]=mmp[3][jou]-ggx;}
}
}
}}
ex=(int)(100*toav); ggx=ex/100.0;
impho.setText("tV "+Double.toString(ggx)); // show total V to two decimal places
// distribute repulsive V among nuclei to each electron based on rhp[][5]
double hiwa=0.0;
for (int rv=0; rv <=13; rv++) { hiwa=hiwa+rhp[rv][5]; }
for (int rv=0; rv <=13; rv++) {
rhp[rv][3]=rhp[rv][3]+(potc*rhp[rv][5])/hiwa;
ex=(int)(100*rhp[rv][3]); ggx=ex/100.0;
if (rv < 2) {elp[rv][4].setText("V "+Double.toString(ggx));}
if (rv > 3 && rv < 9) {elp[rv-2][4].setText("V "+Double.toString(ggx));}
if (rv > 9 && rv < 12) {elp[rv-3][4].setText("V "+Double.toString(ggx));}
}
gx=0.0; // gx=sum of each potential energy
for (int rv=0; rv <=13; rv++) { gx=gx+rhp[rv][3]; }
gy=-toav*0.5; // gy=total kinetic energy
// distribute kinetic energy to each electron based on rhp[][3]
for (int rv=0; rv <=13; rv++) {
gz=(gy*rhp[rv][3])/gx; rhp[rv][4]=gz;
ex=(int)(100*gz); gz=ex/100.0;
if (rv < 2) {elp[rv][5].setText("T "+Double.toString(gz));}
if (rv > 3 && rv < 9) {elp[rv-2][5].setText("T "+Double.toString(gz));}
if (rv > 9 && rv < 12) {elp[rv-3][5].setText("T "+Double.toString(gz));}
}
int rvv=0;
for (int el=0; el <=1; el++) {
for (int rv=0; rv <=3; rv++) { // show force component acting on elctrons 0-7
rvv=rv+el*4;
gx=Math.sqrt(rpp[rvv][0]*rpp[rvv][0]+rpp[rvv][1]*rpp[rvv][1]+rpp[rvv][2]*rpp[rvv][2]);
// gy=inner product of rhp and rpp = force in the direction of rpp
gy=(rhp[rvv][0]*rpp[rvv][0]+rhp[rvv][1]*rpp[rvv][1]+rhp[rvv][2]*rpp[rvv][2])/gx;
ex=(int)(1000*gy); ww="CF ";
if (rvv < 2) {elp[rvv][6].setText(ww+Integer.toString(ex));}
if (rvv > 3) {elp[rvv-2][6].setText(ww+Integer.toString(ex));}
for (int jou=0; jou <=2; jou++) {
gz=rhp[rvv][jou]-(gy*rpp[rvv][jou])/gx;
ex=(int)(1000*gz); // show force component other than CF
if (rvv < 2) {elp[rvv][jou+7].setText(Integer.toString(ex));}
if (rvv > 3) {elp[rvv-2][jou+7].setText(Integer.toString(ex));}
}
}}
for (int rv=8; rv <=13; rv++) { // show force component acting on electron 8-13
ez=0; if (rv > 10) {ez=1;}
// ggy=distance between C-H (nuclei)
ggy=Math.sqrt((nux[ez][0]-nux[rv-6][0])*(nux[ez][0]-nux[rv-6][0])+
(nux[ez][1]-nux[rv-6][1])*(nux[ez][1]-nux[rv-6][1])+(nux[ez][2]-nux[rv-6][2])*(nux[ez][2]-nux[rv-6][2]));
// gy=inner product
gy=((nux[ez][0]-hpr[rv][0])*(nux[ez][0]-nux[rv-6][0])+
(nux[ez][1]-hpr[rv][1])*(nux[ez][1]-nux[rv-6][1])+(nux[ez][2]-hpr[rv][2])*(nux[ez][2]-nux[rv-6][2]))/ggy;
double ttj[][]=new double[6][4];
for (int jou=0; jou <=2; jou++) {
// ttj[][0-2]=vector perpendicular to each C-H line
ttj[rv-8][jou]=(gy*(nux[rv-6][jou]-nux[ez][jou]))/ggy-(hpr[rv][jou]-nux[ez][jou]);
}
ggz=Math.sqrt(ttj[rv-8][0]*ttj[rv-8][0]+ttj[rv-8][1]*ttj[rv-8][1]+ttj[rv-8][2]*ttj[rv-8][2]);
// gz= force component (CF) in the direction of ttj = inner product of rhp and ttj
gz=(rhp[rv][0]*ttj[rv-8][0]+rhp[rv][1]*ttj[rv-8][1]+rhp[rv][2]*ttj[rv-8][2])/ggz;
ex=(int)(1000*gz); ww="CF ";
if (rv==8 ) {elp[6][6].setText(ww+Integer.toString(ex));}
if (rv==10 ) {elp[7][6].setText(ww+Integer.toString(ex));}
if (rv==11) {elp[8][6].setText(ww+Integer.toString(ex));}
for (int jou=0; jou <=2; jou++) { // show force component other than CF
gx=rhp[rv][jou]-(gz*ttj[rv-8][jou])/ggz;
ex=(int)(1000*gx);
if (rv==8) {elp[6][jou+7].setText(Integer.toString(ex));}
if (rv==10) {elp[7][jou+7].setText(Integer.toString(ex));}
if (rv==11) {elp[8][jou+7].setText(Integer.toString(ex));}
}
}
for (int rv=0; rv <=3; rv++) {
for (int jou=0; jou <=2; jou++) { // show mmpho[0-3][0-2]= force acting on each nuclei
ex=(int)(1000*mmp[rv][jou]); ww=" ";
if (jou==0) {ww="FX=";}
if (jou==1) {ww="FY=";}
if (jou==2) {ww="FZ=";}
mmpho[rv][jou].setText(ww+Integer.toString(ex));
}}
// ggy=distance between C0 and H0 nuclei
ggy=Math.sqrt((nux[0][0]-nux[2][0])*(nux[0][0]-nux[2][0])+
(nux[0][1]-nux[2][1])*(nux[0][1]-nux[2][1])+(nux[0][2]-nux[2][2])*(nux[0][2]-nux[2][2]));
// ggz=force component of H0 nucleus toward C0 nucleus
ggz=(mmp[2][0]*(nux[0][0]-nux[2][0])+mmp[2][1]*(nux[0][1]-nux[2][1])+mmp[2][2]*(nux[0][2]-nux[2][2]))/ggy;
imppo.setText("CnH0 = "+Integer.toString((int)(1000*ggz)));
// ggy=distance between C1 and H3 nuclei
ggy=Math.sqrt((nux[1][0]-nux[5][0])*(nux[1][0]-nux[5][0])+
(nux[1][1]-nux[5][1])*(nux[1][1]-nux[5][1])+(nux[1][2]-nux[5][2])*(nux[1][2]-nux[5][2]));
// ggz=force component of H3 nucleus toward C1 nucleus
ggz=(mmp[3][0]*(nux[1][0]-nux[5][0])+mmp[3][1]*(nux[1][1]-nux[5][1])+mmp[3][2]*(nux[1][2]-nux[5][2]))/ggy;
imppp.setText("CnH3 = "+Integer.toString((int)(1000*ggz)));
for (int rv=0; rv <=13; rv++) { // show de Broglie wave of each electron
gz=Math.sqrt(rhp[rv][0]*rhp[rv][0]+rhp[rv][1]*rhp[rv][1]+rhp[rv][2]*rhp[rv][2]);
if (rv < 8) {gz=Math.sqrt(teqq[rv][0]*teqq[rv][0]+teqq[rv][1]*teqq[rv][1]+teqq[rv][2]*teqq[rv][2]);
}
gy=(gz*elc*elc)/(4*pai*epsi*suh*1.0e-28); // gy=force (N)
gx=Math.sqrt((2*rhp[rv][4]*1.602177e-19)/me); // gx=velocity (m/s) from kinetic energy
// electrons 0-4 use potential V (and T) only in carbon atom
if (rv < 8) { gx=Math.sqrt((-teqq[rv][3]*1.602177e-19)/me); }
ggx=(me*gx*gx)/gy; // ggx= "tenporary" radius (m)
ggy=(2*pai*ggx*me*gx)/h; // ggy (wn) = number of de Broglie's waves contained in one orbit
ex=(int)(ggy*1000); ggy=ex/1000.0; // show wn to three decimal places
if (rv < 2) {elp[rv][10].setText("wn "+Double.toString(ggy));}
if (rv > 3 && rv < 9) {elp[rv-2][10].setText("wn "+Double.toString(ggy));}
if (rv > 9 && rv < 12) {elp[rv-3][10].setText("wn "+Double.toString(ggy));}
}
// --------------------- show picture
int nmx[][]=new int[8][3]; int hpk[][]=new int[14][4];
for (int yp=0; yp <=7; yp++) {
for (int kj=0; kj <=2; kj++) { // change MM to pixel in nuclei
nmx[yp][kj]=(int)(nux[yp][kj]/71.428);
}}
for (int yp=0; yp <=13; yp++) {
for (int kj=0; kj <=2; kj++) { // change MM to pixel in electrons
hpk[yp][kj]=(int)(hpr[yp][kj]/71.428);
if (hpk[yp][kj] > 529 && kj==0) {hpk[yp][kj]=529;} // upper and lower limit of coordinate
if (hpk[yp][kj] > 369 && kj > 0) {hpk[yp][kj]=369;}
if (hpk[yp][kj] < 1) {hpk[yp][kj]=1;}
}}
g.clearRect(9,299,1170,699);
g.setColor(Color.cyan); g.drawLine(555,310,555,660);
g.drawString("X - Y plane",270,650);
g.drawString("X - Z plane",820,650);
for (int rv=0; rv <=13; rv++) {
g.setColor(Color.blue);
if (rv < 4) {g.drawLine(hpk[rv][0]+20,680-hpk[rv][1],nmx[0][0]+20,680-nmx[0][1]);
g.drawLine(hpk[rv][0]+560,680-hpk[rv][2],nmx[0][0]+560,680-nmx[0][2]);}
if (rv < 8 && rv > 3) {g.drawLine(hpk[rv][0]+20,680-hpk[rv][1],nmx[1][0]+20,680-nmx[1][1]);
g.drawLine(hpk[rv][0]+560,680-hpk[rv][2],nmx[1][0]+560,680-nmx[1][2]);}
g.setColor(Color.white); // set color based on electron
if (rv > 1 && rv < 4) {g.setColor(Color.red);}
if (rv > 3 && rv < 6) {g.setColor(Color.green);}
if (rv > 5 && rv < 8) {g.setColor(Color.pink);}
if (rv > 7 && rv < 10) {g.setColor(Color.green);}
if (rv > 9 && rv < 12) {g.setColor(Color.yellow);}
if (rv > 11 && rv < 14) {g.setColor(Color.white);}
g.fillOval(hpk[rv][0]+13,673-hpk[rv][1],14,14);
g.fillOval(hpk[rv][0]+553,673-hpk[rv][2],14,14);
}
g.setColor(Color.lightGray); // show eight nuclei
for (int rv=0; rv <=1; rv++) {
g.fillOval(nmx[rv][0]+10,670-nmx[rv][1],20,20);g.fillOval(550+nmx[rv][0],670-nmx[0][2],20,20);
}
for (int rv=2; rv <=7; rv++) {
g.fillOval(13+nmx[rv][0],673-nmx[rv][1],14,14);g.fillOval(553+nmx[rv][0],673-nmx[rv][2],14,14);
}
for (int rw=0; rw <=7; rw++) { // show each nucleus number
g.setColor(Color.white);
if (rw < 2) { ww="C"+Integer.toString(rw);
g.drawString(ww,nmx[rw][0]+13,685-nmx[rw][1]);
g.drawString(ww,nmx[rw][0]+553,685-nmx[rw][2] );}
if (rw > 1) { ex=rw-2; ww="H"+Integer.toString(ex);
g.drawString(ww,nmx[rw][0]+13,685-nmx[rw][1]);
g.drawString(ww,nmx[rw][0]+553,685-nmx[rw][2] );}
}
for (int rw=0; rw <=13; rw++) { // show each electron's number
g.setColor(Color.blue);
if (rw < 10) {
g.drawString(Integer.toString(rw),hpk[rw][0]+17,685-hpk[rw][1]);
g.drawString(Integer.toString(rw),hpk[rw][0]+557,685-hpk[rw][2] );}
if (rw > 9) {
g.drawString(Integer.toString(rw),hpk[rw][0]+14,685-hpk[rw][1]);
g.drawString(Integer.toString(rw),hpk[rw][0]+554,685-hpk[rw][2] );}
}
}
}