📄 atom.java
字号:
/*---------------------------------------------------------------------- File : Atom.java Contents: Atom management for molecules Author : Christian Borgelt History : 11.03.2002 file created 13.03.2002 atom type definitions added 14.03.2002 memory optimization added 19.03.2002 bug in function sortBonds fixed 22.03.2002 second constructor added 28.03.2002 atom type changed to protected 03.08.2003 ring flag evaluation added to function sortBonds 20.07.2005 parameter 'masks' removed from sortBonds 23.07.2005 sorting order of an atom's bonds inverted 01.08.2005 label and corresponding mask removed 08.05.2006 function sortBondsEx added 12.05.2006 bond comparison in sortBonds simplified 10.08.2006 charge coding changed, chain type added 13.08.2006 insertion sort only for small bond arrays----------------------------------------------------------------------*/package moss;import java.util.Comparator;import java.util.Arrays;/*--------------------------------------------------------------------*/public class Atom {/*--------------------------------------------------------------------*/ /* --- constants: element types --- */ public static final int UNKNOWN = -1; public static final int ANY = 0; public static final int HYDROGEN = 1; /* H */ public static final int HELIUM = 2; /* He */ public static final int LITHIUM = 3; /* Li */ public static final int BERYLLIUM = 4; /* Be */ public static final int BORON = 5; /* B */ public static final int CARBON = 6; /* C */ public static final int NITROGEN = 7; /* N */ public static final int OXYGEN = 8; /* O */ public static final int FLOURINE = 9; /* F */ public static final int NEON = 10; /* Ne */ public static final int SODIUM = 11; /* Na */ public static final int MAGNESIUM = 12; /* Mg */ public static final int ALUMINUM = 13; /* Al */ public static final int SILICON = 14; /* Si */ public static final int PHOSPHORUS = 15; /* P */ public static final int SULFUR = 16; /* S */ public static final int CHLORINE = 17; /* Cl */ public static final int ARGON = 18; /* Ar */ public static final int POTASSIUM = 19; /* K */ public static final int CALCIUM = 20; /* Ca */ public static final int SCANDIUM = 21; /* Sc */ public static final int TITANIUM = 22; /* Ti */ public static final int VANADIUM = 23; /* V */ public static final int CHROMIUM = 24; /* Cr */ public static final int MANGANESE = 25; /* Mn */ public static final int IRON = 26; /* Fe */ public static final int COBALT = 27; /* Co */ public static final int NICKEL = 28; /* Ni */ public static final int COPPER = 29; /* Cu */ public static final int ZINC = 30; /* Zn */ public static final int GALLIUM = 31; /* Ga */ public static final int GERMANIUM = 32; /* Ge */ public static final int ARSENIC = 33; /* As */ public static final int SELENIUM = 34; /* Se */ public static final int BROMINE = 35; /* Br */ public static final int KRYPTON = 36; /* Kr */ public static final int RUBIDIUM = 37; /* Rb */ public static final int STRONTIUM = 38; /* Sr */ public static final int YTTRIUM = 39; /* Y */ public static final int ZIRCONIUM = 40; /* Zr */ public static final int NIOBIUM = 41; /* Nb */ public static final int MOLYBDENUM = 42; /* Mo */ public static final int TECHNETIUM = 43; /* Tc */ public static final int RUTHENIUM = 44; /* Ru */ public static final int RHODIUM = 45; /* Rh */ public static final int PALLADIUM = 46; /* Pd */ public static final int SILVER = 47; /* Ag */ public static final int CADMIUM = 48; /* Cd */ public static final int INDIUM = 49; /* In */ public static final int TIN = 50; /* Sn */ public static final int ANTIMONY = 51; /* Sb */ public static final int TELLURIUM = 52; /* Te */ public static final int IODINE = 53; /* I */ public static final int XENON = 54; /* Xe */ public static final int CESIUM = 55; /* Cs */ public static final int BARIUM = 56; /* Ba */ public static final int LANTHANUM = 57; /* La */ public static final int CERIUM = 58; /* Ce */ public static final int PRASEODYMIUM = 59; /* Pr */ public static final int NEODYMIUM = 60; /* Nd */ public static final int PROMETHIUM = 61; /* Pm */ public static final int SAMARIUM = 62; /* Sm */ public static final int EUROPIUM = 63; /* Eu */ public static final int GADOLINIUM = 64; /* Gd */ public static final int TERBIUM = 65; /* Tb */ public static final int DYSPROSIUM = 66; /* Dy */ public static final int HOLMIUM = 67; /* Ho */ public static final int ERBIUM = 68; /* Er */ public static final int THULIUM = 69; /* Tm */ public static final int YTTERBIUM = 70; /* Yb */ public static final int LUTETIUM = 71; /* Lu */ public static final int HAFNIUM = 72; /* Hf */ public static final int TANTALUM = 73; /* Ta */ public static final int TUNGSTEN = 74; /* W */ public static final int RHENIUM = 75; /* Re */ public static final int OSMIUM = 76; /* Os */ public static final int IRIDIUM = 77; /* Ir */ public static final int PLATINUM = 78; /* Pt */ public static final int GOLD = 79; /* Au */ public static final int MERCURY = 80; /* Hg */ public static final int THALLIUM = 81; /* Tl */ public static final int LEAD = 82; /* Pb */ public static final int BISMUTH = 83; /* Bi */ public static final int POLONIUM = 84; /* Po */ public static final int ASTATINE = 85; /* At */ public static final int RADON = 86; /* Rn */ public static final int FRANCIUM = 87; /* Fr */ public static final int RADIUM = 88; /* Ra */ public static final int ACTINIUM = 89; /* Ac */ public static final int THORIUM = 90; /* Th */ public static final int PROTACTINIUM = 91; /* Pa */ public static final int URANIUM = 92; /* U */ public static final int NEPTUNIUM = 93; /* Np */ public static final int PLUTONIUM = 94; /* Pu */ public static final int AMERICUM = 95; /* Am */ public static final int CURIUM = 96; /* Cm */ public static final int BERKELIUM = 97; /* Bk */ public static final int CALIFORNIUM = 98; /* Cf */ public static final int EINSTEINIUM = 99; /* Es */ public static final int FERMIUM = 100; /* Fm */ public static final int MENDELEVIUM = 101; /* Md */ public static final int NOBELIUM = 102; /* No */ public static final int LAWRENCIUM = 103; /* Lr */ public static final int RUTHERFORDIUM = 104; /* Rf */ public static final int DUBNIUM = 105; /* Db */ public static final int SEABORGIUM = 106; /* Sg */ public static final int BOHRIUM = 107; /* Bh */ public static final int HASSIUM = 108; /* Hs */ public static final int MEITNERIUM = 109; /* Mt */ public static final int ELEMCNT = 126; /* = 0x7e */ /* The type of an element is its position in the periodic table. */ /* --- constants: atom flags/masks --- */ public static final int TYPEMASK = 0x0000007f; public static final int AROMATIC = 0x00000080; public static final int CHARGEMASK = 0x00001f00; public static final int CHARGESHIFT = 8; public static final int CHAIN = Integer.MAX_VALUE -1; /* The type of an atom is its position in the element map provided */ /* by the class Elements. Additional type information comprises an */ /* aromatic flag (bit 7, not be confused with Bond.AROMATIC) and a */ /* charge (bit 8 to 12, coding values -15 = 0x1f to +15 = 0x0f). */ /* --- constants: element names --- */ protected static final String[] names = {"*", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "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", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "*", "*" }; /* the periodic table of elements */ /* --- constants: atoms with one letter names --- */ protected static final int[] oneLetter = { HYDROGEN /* H */, BORON /* B */,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -