org.jmol.util
Class JmolMolecule

java.lang.Object
  extended by 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
 int[] altElementCounts
           
 int altElementMax
           
 int atomCount
           
 java.util.BitSet atomList
           
 int[] elementCounts
           
 int elementNumberMax
           
 int firstAtomIndex
           
 int indexInModel
           
 java.lang.String mf
           
 int modelIndex
           
 int moleculeIndex
           
 int nElements
           
 JmolNode[] nodes
           
 
Constructor Summary
  JmolMolecule()
           
private JmolMolecule(JmolNode[] nodes, int moleculeIndex, int firstAtomIndex, java.util.BitSet atomList, int modelIndex, int indexInModel)
           
 
Method Summary
static JmolMolecule[] addMolecule(JmolMolecule[] molecules, int iMolecule, JmolNode[] atoms, int iAtom, java.util.BitSet bsBranch, int modelIndex, int indexInModel, java.util.BitSet bsExclude)
           
private static JmolMolecule[] allocateArray(JmolMolecule[] molecules, int len)
           
static java.util.BitSet getBranchBitSet(JmolNode[] atoms, int atomIndex, java.util.BitSet bsToTest, java.util.List<java.util.BitSet> 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(JmolNode[] atoms, JmolNode atom, java.util.BitSet bsToTest, boolean allowCyclic, boolean allowBioResidue, java.util.List<java.util.BitSet> biobranches, java.util.BitSet bsResult)
           
private  void getElementAndAtomCount(boolean includeMissingHydrogens)
           
 java.lang.String getMolecularFormula(boolean includeMissingHydrogens)
           
static java.lang.String getMolecularFormula(JmolNode[] atoms, java.util.BitSet bsSelected, boolean includeMissingHydrogens)
           
static JmolMolecule[] getMolecules(JmolNode[] atoms, java.util.BitSet[] bsModelAtoms, java.util.List<java.util.BitSet> biobranches, java.util.BitSet bsExclude)
          Creates an array of JmolMolecules from a set of atoms in the form of simple JmolNodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodes

public JmolNode[] nodes

moleculeIndex

public int moleculeIndex

modelIndex

public int modelIndex

indexInModel

public int indexInModel

firstAtomIndex

public int firstAtomIndex

atomCount

public int atomCount

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 java.util.BitSet atomList
Constructor Detail

JmolMolecule

public JmolMolecule()

JmolMolecule

private JmolMolecule(JmolNode[] nodes,
                     int moleculeIndex,
                     int firstAtomIndex,
                     java.util.BitSet atomList,
                     int modelIndex,
                     int indexInModel)
Method Detail

getMolecules

public static final JmolMolecule[] getMolecules(JmolNode[] atoms,
                                                java.util.BitSet[] bsModelAtoms,
                                                java.util.List<java.util.BitSet> biobranches,
                                                java.util.BitSet 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 java.util.BitSet getBranchBitSet(JmolNode[] atoms,
                                               int atomIndex,
                                               java.util.BitSet bsToTest,
                                               java.util.List<java.util.BitSet> 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,
                                               JmolNode[] atoms,
                                               int iAtom,
                                               java.util.BitSet bsBranch,
                                               int modelIndex,
                                               int indexInModel,
                                               java.util.BitSet bsExclude)

getMolecularFormula

public static java.lang.String getMolecularFormula(JmolNode[] atoms,
                                                   java.util.BitSet bsSelected,
                                                   boolean includeMissingHydrogens)

getMolecularFormula

public java.lang.String getMolecularFormula(boolean includeMissingHydrogens)

getElementAndAtomCount

private void getElementAndAtomCount(boolean includeMissingHydrogens)

getCovalentlyConnectedBitSet

private static boolean getCovalentlyConnectedBitSet(JmolNode[] atoms,
                                                    JmolNode atom,
                                                    java.util.BitSet bsToTest,
                                                    boolean allowCyclic,
                                                    boolean allowBioResidue,
                                                    java.util.List<java.util.BitSet> biobranches,
                                                    java.util.BitSet bsResult)

allocateArray

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