//====================================================== // Thermodynamic Package in java // Class Atom // Properties of single atom // ----------------------------------------------------- // Dr. Turhan Coban // TUBITAK Ulusal Metroloji Enstitüsü, Gebze KOcaeli, Turkey // email : Turhan.Coban@ume.tubitak.gov.tr // ----------------------------------------------------- // File Name : Atom.java // This file contains the atom class // this class sets basic properties of requested atoms // ===================================================== import java.io.*; import java.util.*; class Atom { public int number; // atomic number public String name; // name of the the atom public String symbol; // symbol of the atom public double mass; // mass of the atom public double N; // number of the atoms public int s[]=new int[7]; public int d[]=new int[7]; public int p[]=new int[7]; public int f[]=new int[7]; public Atom() { //empty constructor number=0; symbol=""; name=""; mass=0; N=1; } public Atom(String st1, double NN) { getAtom(st1,NN); } public Atom(String st1, int NN) { getAtom(st1,(double)NN); } public Atom(String st1) { getAtom(st1,1.0); } public Atom(Atom a) { assign(a); } public Atom(Atom a, double NN) { assign(a); N=NN; } //================================================================= public void getAtom(String st1,double NN) { // this constructor will load Atom data from a given atom name // or atom symbol and number of atoms // type String atom_name[]={"Hydrogen", "Helium", "Lithium", "Berylium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Florine", "Neon", "Sodium", "Magnesium", "Aliminium", "Silicon", "Phosphourus", "Sulphur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Kyrpton", "Rubidium", "Strontium","Yttirum", "Zirconium", "Niobium", "Molybdenium", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Anthimony", "Tellerium", "Iodine", "Xenon", "Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinium", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium","Protactinium","Uranium", "Neptunium","Plutonium","Americium","Curium","Berkelium","Californium","Einsteinium","Fermium","Mendelevium","Nobelium", "Lawrencium","Rutherfordium","Dubnium","Seaborgium","Bohrium","Hassium","Meithnerium"}; String atom_symbol[]= {"H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Ag", "P", "S", "Cl", "Ar", "K", "Ca", "Se", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Si", "Br", "Kr", "Ru", "Sr", "Yt", "Zr", "Nb", "Mo", "Tc", "Sm", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb","Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sc", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr","Rf","Db","Sg","Bh","Hs","Mt"}; double atom_mass[]= {1.00794, 4.002602, 6.941, 9.012182, 10.811, 12.011, 14.00674, 15.9994, 18.9984032, 20.1797, 22.989768, 24.305, 26.981539, 28.0855, 30.973762, 32.066, 35.4527, 39.938, 39.0983, 40.078, 44.95591, 47.88, 50.9415, 51.9961, 54.93805, 55.587, 58.9332, 58.69, 63.546, 65.39, 69.723, 72.61, 74.92159, 78.96, 79.904, 83.8, 85.4678, 87.62, 88.90585, 91.224, 92.90638, 95.94, 98.0, 101.007, 102.9055, 106.42, 107.8682, 112.411, 114.82, 118.71, 121.75, 127.6, 126.90447, 131.29, 132.90543, 137.327, 138.9055, 140.115, 140.90765, 144.24, 145.0, 150.36, 151.965, 157.25, 158.92534, 162.5, 164.93032, 167.26, 168.93421, 173.04, 174.967, 178.49, 180.9479, 183.85, 186.207, 190.2, 192.22, 195.08, 196.96654, 200.59, 204.3833, 207.2, 208.98037, 209.0, 210.0, 222.0, 223.0, 226.0, 227.0, 232.0381, 231.0, 238.0289, 237.0, 244.0, 243.0, 247.0, 247.0, 251.0, 252.0, 257.0, 258.0, 259.0, 260.0,261.0,262.0,263.0,262.0,265.0,266.0 }; for(int atom_number=1;atom_number<=109;atom_number++) { if(st1.equals(atom_name[atom_number-1]) || st1.equals(atom_symbol[atom_number-1]) ) { N=NN; number=atom_number; name=atom_name[atom_number-1]; symbol=atom_symbol[atom_number-1]; mass=atom_mass[atom_number-1]*N; break; } } } //================================================================= public void assign(Atom a) { number=a.number; name=a.name; symbol=a.symbol; mass=a.mass; N=a.N; } //================================================================= //boolean equals logical comparisons public boolean equals(String s) { boolean b; if(name.equals(s) || symbol.equals(s)) return true; else return false; } public boolean equals(int n) { boolean b; if(number==n) return true; else return false; } //================================================================= //this ostream function will send the symbol+number of atoms to cout public String toString() { String st=symbol; if(N != 1.0) if(N==Math.floor(N)) st = st + (int)N; else st = st + N; return st; } } //=================================================================