Class IsotopeFactory

  • Direct Known Subclasses:
    Isotopes, XMLIsotopeFactory

    public abstract class IsotopeFactory
    extends Object
    Used to store and return data of a particular isotope. The classes Isotopes extends this class and is to be used to get isotope information.
    Author:
    steinbeck
    Source code:
    main
    Belongs to CDK module:
    core
    Created on:
    2001-08-29
    • Field Detail

      • EMPTY_ISOTOPE_ARRAY

        public static final IIsotope[] EMPTY_ISOTOPE_ARRAY
    • Constructor Detail

      • IsotopeFactory

        public IsotopeFactory()
    • Method Detail

      • getSize

        public int getSize()
        Returns the number of isotopes defined by this class.
        Returns:
        The size value
      • add

        protected void add​(IIsotope isotope)
        Protected methods only to be used by classes extending this class to add an IIsotope.
      • getIsotopes

        public IIsotope[] getIsotopes​(int elem)
        Gets an array of all isotopes known to the IsotopeFactory for the given element symbol.
        Parameters:
        elem - atomic number
        Returns:
        An array of isotopes that matches the given element symbol
      • getIsotopes

        public IIsotope[] getIsotopes​(String symbol)
        Gets an array of all isotopes known to the IsotopeFactory for the given element symbol.
        Parameters:
        symbol - An element symbol to search for
        Returns:
        An array of isotopes that matches the given element symbol
      • getIsotopes

        public IIsotope[] getIsotopes()
        Gets a array of all isotopes known to the IsotopeFactory.
        Returns:
        An array of all isotopes
      • getIsotopes

        public IIsotope[] getIsotopes​(double exactMass,
                                      double difference)
        Gets an array of all isotopes matching the searched exact mass within a certain difference.
        Parameters:
        exactMass - search mass
        difference - mass the isotope is allowed to differ from the search mass
        Returns:
        An array of all isotopes
      • getIsotope

        public IIsotope getIsotope​(String symbol,
                                   int massNumber)
        Get isotope based on element symbol and mass number.
        Parameters:
        symbol - the element symbol
        massNumber - the mass number
        Returns:
        the corresponding isotope
      • getIsotope

        public IIsotope getIsotope​(String symbol,
                                   double exactMass,
                                   double tolerance)
        Get an isotope based on the element symbol and exact mass.
        Parameters:
        symbol - the element symbol
        exactMass - the mass number
        tolerance - allowed difference from provided exact mass
        Returns:
        the corresponding isotope
      • getMajorIsotope

        public IIsotope getMajorIsotope​(int elem)
        Returns the most abundant (major) isotope with a given atomic number. Note that some high mass elements do not have a major isotopes (0% abundance) and this method will return null for those.
        Parameters:
        elem - The atomicNumber for which an isotope is to be returned
        Returns:
        The isotope corresponding to the given atomic number
        See Also:
        getMajorIsotope(String symbol)
      • getMajorIsotopeMass

        public double getMajorIsotopeMass​(int elem)
        Get the mass of the most abundant (major) isotope, if there is no major isotopes 2*elem is returned.
        Parameters:
        elem - the atomic number
        Returns:
        the major isotope mass
      • getExactMass

        public double getExactMass​(Integer atomicNumber,
                                   Integer massNumber)
        Get the exact mass of a specified isotope for an atom. If there is no isotope with that mass number then it is returned.
        Parameters:
        atomicNumber - atomic number
        massNumber - the mass number
        Returns:
        the exact mass
      • isElement

        public boolean isElement​(String elementName)
        Checks whether the given element exists.
        Parameters:
        elementName - The element name to test
        Returns:
        True is the element exists, false otherwise
      • getMajorIsotope

        public IIsotope getMajorIsotope​(String symbol)
        Returns the most abundant (major) isotope whose symbol equals element.
        Parameters:
        symbol - the symbol of the element in question
        Returns:
        The Major Isotope value
      • getElement

        public IElement getElement​(String symbol)
        Returns an Element with a given element symbol.
        Parameters:
        symbol - The element symbol for the requested element
        Returns:
        The configured element
      • getElement

        public IElement getElement​(int atomicNumber)
        Returns an element according to a given atomic number.
        Parameters:
        atomicNumber - The elements atomic number
        Returns:
        The Element
      • getElementSymbol

        public String getElementSymbol​(int atomicNumber)
        Returns the symbol matching the element with the given atomic number.
        Parameters:
        atomicNumber - The elements atomic number
        Returns:
        The symbol of the Element
      • configure

        public IAtom configure​(IAtom atom)
        Configures an atom. Finds the correct element type by looking at the atoms element symbol. If the element symbol is not recognised, it will throw an IllegalArgumentException.
        Parameters:
        atom - The atom to be configured
        Returns:
        The configured atom
      • configure

        public IAtom configure​(IAtom atom,
                               IIsotope isotope)
        Configures an atom to have all the data of the given isotope.
        Parameters:
        atom - The atom to be configure
        isotope - The isotope to read the data from
        Returns:
        The configured atom
      • configureAtoms

        public void configureAtoms​(IAtomContainer container)
        Configures atoms in an AtomContainer to carry all the correct data according to their element type.
        Parameters:
        container - The AtomContainer to be configured
      • getNaturalMass

        public double getNaturalMass​(int atomicNum)
        Gets the natural mass of this element, defined as average of masses of isotopes, weighted by abundance.
        Parameters:
        atomicNum - the element in question
        Returns:
        The natural mass value
      • getNaturalMass

        public double getNaturalMass​(IElement element)
        Gets the natural mass of this element, defined as average of masses of isotopes, weighted by abundance.
        Parameters:
        element - the element in question
        Returns:
        The natural mass value