JmolMolecule
Date: 2019-10-22

org.jmol.util

## Class JmolMolecule

- java.lang.Object
- - org.jmol.util.JmolMolecule

- Direct Known Subclasses:
    SmilesSearch

      public class JmolMolecule
      extends java.lang.Object

  an independent class utilizing only org.jmol.api.JmolNode, not org.jmol.modelset.Atom for use in finding molecules in models and SMILES strings

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `ac`
    `int[]` | `altElementCounts`
    `int` | `altElementMax`
    `javajs.util.BS` | `atomList`
    `int[]` | `elementCounts`
    `int` | `elementNumberMax`
    `int` | `firstAtomIndex`
    `int` | `indexInModel`
    `java.lang.String` | `mf`
    `int` | `modelIndex`
    `int` | `moleculeIndex`
    `int` | `nElements`
    `Node[]` | `nodes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JmolMolecule()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JmolMolecule[]` | `addMolecule(JmolMolecule[] molecules, int iMolecule, Node[] atoms, int iAtom, javajs.util.BS bsBranch, int modelIndex, int indexInModel, javajs.util.BS bsExclude)`
    `private static JmolMolecule[]` | `allocateArray(JmolMolecule[] molecules, int len)`
    `static javajs.util.BS` | `getBitSetForMF(Atom[] at, javajs.util.BS bsAtoms, java.lang.String mf)`
    `static javajs.util.BS` | `getBranchBitSet(Node[] atoms, int atomIndex, javajs.util.BS bsToTest, javajs.util.Lst<javajs.util.BS> biobranches, int atomIndexNot, boolean allowCyclic, boolean allowBioResidue)` given a set of atoms, a subset of atoms to test, two atoms that start the branch, and whether or not to allow the branch to cycle back on itself, deliver the set of atoms constituting this branch.
    `private static boolean` | `getCovalentlyConnectedBitSet(Node[] atoms, Node atom, javajs.util.BS bsToTest, boolean allowCyclic, boolean allowBioResidue, javajs.util.Lst<javajs.util.BS> biobranches, javajs.util.BS bsResult)`
    `java.lang.String` | `getMolecularFormula(boolean includeMissingHydrogens, float[] wts, boolean isEmpirical)`
    `static java.lang.String` | `getMolecularFormulaAtoms(Node[] atoms, javajs.util.BS bsSelected, float[] wts, boolean isEmpirical)`
    `static JmolMolecule[]` | `getMolecules(Node[] atoms, javajs.util.BS[] bsModelAtoms, javajs.util.Lst<javajs.util.BS> biobranches, javajs.util.BS bsExclude)` Creates an array of JmolMolecules from a set of atoms in the form of simple JmolNodes.
    `private static JmolMolecule` | `initialize(Node[] nodes, int moleculeIndex, int firstAtomIndex, javajs.util.BS atomList, int modelIndex, int indexInModel)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### nodes

          public Node[] nodes

    - #### moleculeIndex

          public int moleculeIndex

    - #### modelIndex

          public int modelIndex

    - #### indexInModel

          public int indexInModel

    - #### firstAtomIndex

          public int firstAtomIndex

    - #### ac

          public int ac

    - #### nElements

          public int nElements

    - #### elementCounts

          public int[] elementCounts

    - #### altElementCounts

          public int[] altElementCounts

    - #### elementNumberMax

          public int elementNumberMax

    - #### altElementMax

          public int altElementMax

    - #### mf

          public java.lang.String mf

    - #### atomList

          public javajs.util.BS atomList

  - ### Constructor Detail

    - #### JmolMolecule

          public JmolMolecule()

  - ### Method Detail

    - #### getMolecules

          public static final JmolMolecule[] getMolecules(Node[] atoms,
                                                          javajs.util.BS[] bsModelAtoms,
                                                          javajs.util.Lst<javajs.util.BS> biobranches,
                                                          javajs.util.BS bsExclude)

      Creates an array of JmolMolecules from a set of atoms in the form of simple JmolNodes. Allows for appending onto an already established set of branches (from BioPolymer).
      Parameters:
        `atoms` - set of atoms to check
        `bsModelAtoms` - per-model atom list, or null
        `biobranches` - pre-defined connections, like bonds but not to be followed internally
        `bsExclude` - TODO
      Returns:
        an array of JmolMolecules

    - #### getBranchBitSet

          public static javajs.util.BS getBranchBitSet(Node[] atoms,
                                                       int atomIndex,
                                                       javajs.util.BS bsToTest,
                                                       javajs.util.Lst<javajs.util.BS> biobranches,
                                                       int atomIndexNot,
                                                       boolean allowCyclic,
                                                       boolean allowBioResidue)

      given a set of atoms, a subset of atoms to test, two atoms that start the branch, and whether or not to allow the branch to cycle back on itself, deliver the set of atoms constituting this branch.
      Parameters:
        `atoms` -
        `atomIndex` - the first atom of the branch
        `bsToTest` - some subset of those atoms
        `biobranches` - pre-determined groups of connected atoms
        `atomIndexNot` - the "root" atom stopping branch development; often a ring atom; if -1, then this method will return all atoms in a connected set of atoms.
        `allowCyclic` - allow
        `allowBioResidue` - TODO
      Returns:
        a bitset of atoms along this branch

    - #### addMolecule

          public static final JmolMolecule[] addMolecule(JmolMolecule[] molecules,
                                                         int iMolecule,
                                                         Node[] atoms,
                                                         int iAtom,
                                                         javajs.util.BS bsBranch,
                                                         int modelIndex,
                                                         int indexInModel,
                                                         javajs.util.BS bsExclude)

    - #### getMolecularFormulaAtoms

          public static java.lang.String getMolecularFormulaAtoms(Node[] atoms,
                                                                  javajs.util.BS bsSelected,
                                                                  float[] wts,
                                                                  boolean isEmpirical)

    - #### getMolecularFormula

          public java.lang.String getMolecularFormula(boolean includeMissingHydrogens,
                                                      float[] wts,
                                                      boolean isEmpirical)

    - #### initialize

          private static JmolMolecule initialize(Node[] nodes,
                                                 int moleculeIndex,
                                                 int firstAtomIndex,
                                                 javajs.util.BS atomList,
                                                 int modelIndex,
                                                 int indexInModel)

    - #### getCovalentlyConnectedBitSet

          private static boolean getCovalentlyConnectedBitSet(Node[] atoms,
                                                              Node atom,
                                                              javajs.util.BS bsToTest,
                                                              boolean allowCyclic,
                                                              boolean allowBioResidue,
                                                              javajs.util.Lst<javajs.util.BS> biobranches,
                                                              javajs.util.BS bsResult)

    - #### allocateArray

          private static JmolMolecule[] allocateArray(JmolMolecule[] molecules,
                                                      int len)

    - #### getBitSetForMF

          public static javajs.util.BS getBitSetForMF(Atom[] at,
                                                      javajs.util.BS bsAtoms,
                                                      java.lang.String mf)