Package moss

Class AtomTypeMgr

java.lang.Object
moss.TypeMgr
moss.AtomTypeMgr
All Implemented Interfaces:
Serializable

public class AtomTypeMgr extends TypeMgr
Class for an atom type manager.
Since:
2007.06.20
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Ac Actinium
    static final int
    Al Aluminum
    static final int
    Am Americum
    static final int
    Sb Antimony
    static final int
    Ar Argon
    static final int
    the flag indicating whether an atom is part of an aromatic ring
    static final int
    As Arsenic
    static final int
    At Astatine
    static final int
    Ba Barium
    static final int
    Bk Berkelium
    static final int
    Be Beryllium
    static final int
    Bi Bismuth
    static final int
    Bh Bohrium
    static final int
    B Boron
    static final int
    Br Bromine
    static final int
    Cd Cadmium
    static final int
    Ca Calcium
    static final int
    Cf Californium
    static final int
    C Carbon
    static final int
    Ce Cerium
    static final int
    Cs Cesium
    static final int
    the mask for extracting the charge from an atom type
    static final int
    the shift value for extracting the charge from an atom type
    static final int
    Cl Chlorine
    static final int
    Cr Chromium
    static final int
    Co Cobalt
    static final int
    Cn Copernicium
    static final int
    Cu Copper
    static final int
    Cm Curium
    static final int
    Ds Darmstadtium
    static final int
    Db Dubnium
    static final int
    Dy Dysprosium
    static final int
    Es Einsteinium
    static final int
    the number of chemical elements (not all actually exist)
    protected static final String[]
    the periodic table of elements; using the chemical element as an index for this table yields a printable element name
    static final int
    the mask for the chemical element of an atom
    static final int
    Er Erbium
    static final int
    Eu Europium
    static final int
    Fm Fermium
    static final int
    F Flourine
    static final int
    Fr Francium
    static final int
    Gd Gadolinium
    static final int
    Ga Gallium
    static final int
    Ge Germanium
    static final int
    Au Gold
    static final int
    Hf Hafnium
    static final int
    Hs Hassium
    static final int
    He Helium
    static final int
    Ho Holmium
    static final int
    H Hydrogen
    static final int
    the mask for extracting the hydrogens from an atom type
    static final int
    the shift value for extracting the hydrogens from an atom type
    static final int
    In Indium
    static final int
    I Iodine
    static final int
    Ir Iridium
    static final int
    Fe Iron
    static final int
    Kr Krypton
    static final int
    La Lanthanium
    static final int
    Lr Lawrencium
    static final int
    Pb Lead
    static final int
    Li Lithium
    static final int
    Lu Lutetium
    static final int
    Mg Magnesium
    static final int
    Mn Manganese
    protected static int[][]
    the map from element names (character pairs) to element codes
    static final int
    Mt Meitnerium
    static final int
    Md Mendelevium
    static final int
    Hg Mercury
    static final int
    Mo Molybdenum
    static final int
    Nd Neodymium
    static final int
    Ne Neon
    static final int
    Np Neptunium
    static final int
    Ni Nickel
    static final int
    Nb Niobium
    static final int
    N Nitrogen
    static final int
    No Nobelium
    static final int
    null
    static final int
    Os Osmium
    static final int
    O Oxygen
    static final int
    Pd Palladium
    static final int
    P Phosphorus
    static final int
    Pt Platinum
    static final int
    Pu Plutonium
    static final int
    Po Polonium
    static final int
    K Potassium
    static final int
    Pr Praseodynium
    static final int
    Pm Promethium
    static final int
    Pa Proactinium
    static final int
    Ra Radium
    static final int
    Rn Radon
    static final int
    Re Rhenium
    static final int
    Rh Rhodium
    static final int
    Rg Roentgenium
    static final int
    Rb Rubidium
    static final int
    Ru Ruthenium
    static final int
    Rf Rutherfordium
    static final int
    Sm Samarium
    static final int
    Sc Scandium
    static final int
    Sg Seaborgium
    static final int
    Se Selenium
    static final int
    Si Silicon
    static final int
    Ag Silver
    static final int
    Na Sodium
    static final int
    Sr Strontium
    static final int
    S Sulfur
    static final int
    Ta Tantalum
    static final int
    Tc Technetium
    static final int
    Te Tellurium
    static final int
    Tb Terbium
    static final int
    Tl Thallium
    static final int
    Th Thorium
    static final int
    Tm Thulium
    static final int
    Sn Tin
    static final int
    Ti Titanium
    static final int
    W Tungsten
    static final int
    atom type: unknown
    static final int
    U Uranium
    static final int
    V Vanadium
    static final int
    Xe Xenon
    static final int
    Yb Ytterbium
    static final int
    Y Yttrium
    static final int
    Zn Zinc
    static final int
    Zr Zirconium

    Fields inherited from class moss.TypeMgr

    BASEMASK, FLAGMASK, SPECIAL, WILDCARD
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an atom type manager.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    add(String name)
    Add an atom type.
    static int
    codeCharge(int chg)
    Encode a charge for addition to an atom type.
    static int
    codeHydros(int n)
    Encode hydrogens for addition to an atom type.
    static String
    Get the name of a chain atom.
    static int
    getCharge(int type)
    Extract the charge from an atom type.
    int
    Map an atom name to the corresponding code.
    static int
    getElem(int type)
    Extract the chemical element from an atom type.
    static String
    getElemName(int type)
    Extract the name of a chemical element from an atom type.
    static int
    getHydros(int type)
    Extract the hydrogens from an atom type.
    getName(int code)
    Map a code to the corresponding atom name.
    int
    Get the number of managed types.
    static String
    Get the name of a wildcard atom.
    static boolean
    isAromatic(int type)
    Check whether an atom type specifies an aromatic atom.
    static boolean
    isChain(int type)
    Check whether an atom type specifies a chain atom.
    boolean
    Check whether a type manager is fixed (is not extendable).
    static void
    main(String[] args)
    Main function for testing some basic functionality.
    static int
    removeCharge(int type)
    Remove the charge from an atom type.
    static int
    removeExts(int type)
    Remove the extended information from an atom type.
    static int
    removeHydros(int type)
    Remove the hydrogens from an atom type.

    Methods inherited from class moss.TypeMgr

    getBase, isSpecial, isWildcard

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • AtomTypeMgr

      public AtomTypeMgr()
      Create an atom type manager.
      Since:
      2007.06.21 (Christian Borgelt)
  • Method Details

    • isFixed

      public boolean isFixed()
      Check whether a type manager is fixed (is not extendable).
      Specified by:
      isFixed in class TypeMgr
      Returns:
      true, because the atom types are fixed
      Since:
      2009.08.13 (Christian Borgelt)
    • getTypeCount

      public int getTypeCount()
      Get the number of managed types.
      Specified by:
      getTypeCount in class TypeMgr
      Returns:
      the number of types in this type manager
      Since:
      2020.10.16 (Christian Borgelt)
    • add

      public int add(String name)
      Add an atom type.

      The set of atom types is fixed and cannot be extended. Therefore this function behaves exactly like the function getCode() and returns -1 for an unknown name.

      Specified by:
      add in class TypeMgr
      Parameters:
      name - the name of the atom
      Returns:
      the code of the atom or -1 if the name is not an atom description
      Since:
      2007.06.21 (Christian Borgelt)
      See Also:
    • getCode

      public int getCode(String name)
      Map an atom name to the corresponding code.
      Specified by:
      getCode in class TypeMgr
      Parameters:
      name - the name of the atom
      Returns:
      the code of the atom or -1 if the name is not an atom description
      Since:
      2007.06.20 (Christian Borgelt)
    • getName

      public String getName(int code)
      Map a code to the corresponding atom name.
      Specified by:
      getName in class TypeMgr
      Parameters:
      code - the code of the atom
      Returns:
      the name of the atom
      Since:
      2007.03.05/2007.06.21 (Christian Borgelt)
    • getChainName

      public static String getChainName()
      Get the name of a chain atom.
      Returns:
      the name of a chain atom
      Since:
      2007.06.22 (Christian Borgelt)
    • getWildcard

      public static String getWildcard()
      Get the name of a wildcard atom.
      Returns:
      the name of a wildcard atom
      Since:
      2007.06.22 (Christian Borgelt)
    • getElem

      public static int getElem(int type)
      Extract the chemical element from an atom type.

      The chemical element is only part of the type of an atom. The type of an atom also includes an aromatic flag and a possible charge.

      Parameters:
      type - the type from which to extract the chemical element
      Returns:
      the chemical element encoded in the given atom type
      Since:
      2002.03.11 (Christian Borgelt)
    • getElemName

      public static String getElemName(int type)
      Extract the name of a chemical element from an atom type.
      Parameters:
      type - the type from which to extract the chemical element
      Returns:
      the name of the chemical element encoded int the type
      Since:
      2006.10.31 (Christian Borgelt)
    • isChain

      public static boolean isChain(int type)
      Check whether an atom type specifies a chain atom.
      Parameters:
      type - the atom type to check
      Returns:
      whether the atom type specifies a chain atom
      Since:
      2009.08.13 (Christian Borgelt)
    • isAromatic

      public static boolean isAromatic(int type)
      Check whether an atom type specifies an aromatic atom.
      Parameters:
      type - the atom type to check
      Returns:
      whether the atom type is aromatic
      Since:
      2006.10.31 (Christian Borgelt)
    • codeCharge

      public static int codeCharge(int chg)
      Encode a charge for addition to an atom type.

      The result of this function has to be combined with an element type using a bitwise and.

      Parameters:
      chg - the charge to encode
      Returns:
      the encoded charge
      Since:
      2002.03.11 (Christian Borgelt)
    • getCharge

      public static int getCharge(int type)
      Extract the charge from an atom type.
      Parameters:
      type - the type from which to extract the charge
      Returns:
      the charge encoded in the given atom type
      Since:
      2002.03.11 (Christian Borgelt)
    • removeCharge

      public static int removeCharge(int type)
      Remove the charge from an atom type.
      Parameters:
      type - the type from which to remove the charge
      Returns:
      the atom type without any charge
      Since:
      2007.06.22 (Christian Borgelt)
    • codeHydros

      public static int codeHydros(int n)
      Encode hydrogens for addition to an atom type.

      The result of this function has to be combined with an element type using a bitwise and.

      Parameters:
      n - the number of hydrogens to encode
      Returns:
      the encoded number of hydrogens
      Since:
      2007.06.22 (Christian Borgelt)
    • getHydros

      public static int getHydros(int type)
      Extract the hydrogens from an atom type.
      Parameters:
      type - the type from which to extract the hydrogens
      Returns:
      the number of hydrogens encoded in the given atom type
      Since:
      2007.06.22 (Christian Borgelt)
    • removeHydros

      public static int removeHydros(int type)
      Remove the hydrogens from an atom type.
      Parameters:
      type - the type from which to remove the hydrogens
      Returns:
      the atom type without any hydrogens
      Since:
      2007.06.22 (Christian Borgelt)
    • removeExts

      public static int removeExts(int type)
      Remove the extended information from an atom type.
      Parameters:
      type - the type from which to remove the information
      Returns:
      the atom type without extended information
      Since:
      2007.11.09 (Christian Borgelt)
    • main

      public static void main(String[] args)
      Main function for testing some basic functionality.

      It is tried to parse the first command line argument as an atom description and the resulting code is reported.

      Parameters:
      args - the command line arguments
      Since:
      2007.06.21 (Christian Borgelt)