org.jmol.modelset
Class BondCollection

java.lang.Object
  extended by org.jmol.modelset.AtomCollection
      extended by org.jmol.modelset.BondCollection
Direct Known Subclasses:
ModelCollection

public abstract class BondCollection
extends AtomCollection


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jmol.modelset.AtomCollection
AtomCollection.AtomSorter
 
Field Summary
protected static int BOND_GROWTH_INCREMENT
           
protected  int bondCount
           
protected  Bond[] bonds
           
protected  java.util.BitSet bsAromatic
           
private  java.util.BitSet bsAromaticDouble
           
private  java.util.BitSet bsAromaticSingle
           
protected  java.util.BitSet bsHBondsRasmol
           
protected  short defaultCovalentMad
           
protected  Bond[][][] freeBonds
           
protected  boolean haveHiddenBonds
           
private  boolean haveWarned
           
protected static int MAX_BONDS_LENGTH_TO_CACHE
           
protected static int MAX_NUM_TO_CACHE
           
protected  int moleculeCount
           
protected  JmolMolecule[] molecules
           
protected  int[] numCached
           
 
Fields inherited from class org.jmol.modelset.AtomCollection
atomCount, atomNames, atoms, atomSerials, atomTypes, bfactor100s, bspf, ellipsoids, g3d, haveStraightness, hydrophobicities, ionicRadii, maxBondingRadius, occupancies, partialCharges, preserveState, surfaceDistance100s, TAINT_ATOMNAME, TAINT_ATOMNO, TAINT_ATOMTYPE, TAINT_COORD, TAINT_ELEMENT, TAINT_FORMALCHARGE, TAINT_HYDROPHOBICITY, TAINT_MAX, tainted, vibrationVectors, viewer
 
Constructor Summary
BondCollection()
           
 
Method Summary
private  void addBondToAtom(Atom atom, Bond bond)
           
protected  int addHBond(Atom atom1, Atom atom2, int order, float energy)
           
private  Bond[] addToBonds(Bond newBond, Bond[] oldBonds)
           
 void assignAromaticBonds()
           
protected  void assignAromaticBonds(boolean isUserCalculation, java.util.BitSet bsBonds)
          algorithm discussed above.
private  boolean assignAromaticDouble(Atom atom)
          N atoms with 3 bonds cannot also have a double bond; other atoms need one and only one double bond; the rest must be single bonds.
private  boolean assignAromaticDouble(Bond bond)
          try to assign AROMATICDOUBLE to this bond.
private  void assignAromaticNandO(java.util.BitSet bsSelected)
           
private  boolean assignAromaticSingle(Atom atom, int notBondIndex)
          N atoms with 3 bonds cannot also have a double bond; other atoms needs all single bonds, because the bond leading up to it is double.
private  boolean assignAromaticSingle(Bond bond)
          try to assign AROMATICSINGLE to this bond.
private  boolean assignAromaticSingleHetero(Atom atom)
           
 Bond bondAtoms(Atom atom1, Atom atom2, int order, short mad, java.util.BitSet bsBonds, float energy, boolean addGroup, boolean isNew)
           
protected  Bond bondMutually(Atom atom, Atom atomOther, int order, short mad, float energy)
           
protected  boolean checkValencesAndBond(Atom atomA, Atom atomB, int order, short mad, java.util.BitSet bsBonds)
           
protected  void deleteAllBonds()
           
 void deleteBonds(java.util.BitSet bsBond, boolean isFullModel)
           
protected  int[] deleteConnections(float minDistance, float maxDistance, int order, java.util.BitSet bsA, java.util.BitSet bsB, boolean isBonds, boolean matchNull, float minDistanceSquared, float maxDistanceSquared)
           
 void displayBonds(Bond.BondSet bs, boolean isDisplay)
           
protected  java.util.BitSet getAtomBitsMaybeDeleted(int tokType, java.lang.Object specInfo)
          general unqualified lookup of atom set type
 Bond getBondAt(int bondIndex)
           
 Atom getBondAtom1(int i)
           
 Atom getBondAtom2(int i)
           
 short getBondColix1(int i)
           
 short getBondColix2(int i)
           
 int getBondCount()
           
protected  int getBondCountInModel(int modelIndex)
          for general use
 BondIterator getBondIterator(java.util.BitSet bsSelected)
           
 BondIterator getBondIterator(int bondType, java.util.BitSet bsSelected)
           
 int getBondModelIndex(int i)
           
protected static short getBondOrder(float bondingRadiusA, float bondingRadiusB, float distance2, float minBondDistance2, float bondTolerance)
           
 int getBondOrder(int i)
           
 float getBondRadius(int i)
           
 Bond[] getBonds()
           
 java.util.BitSet getBondsForSelectedAtoms(java.util.BitSet bsAtoms, boolean bondSelectionModeOr)
           
 short getDefaultMadFromOrder(int order)
          When creating a new bond, determine bond diameter from order
private  Bond getOrAddBond(Atom atom, Atom atomOther, int order, short mad, java.util.BitSet bsBonds, float energy, boolean overrideBonding)
           
(package private)  void getRasmolHydrogenBonds(Model m, java.util.BitSet bsA, java.util.BitSet bsB, java.util.List<Bond> vHBonds, boolean nucleicOnly, int nMax, boolean dsspIgnoreHydrogens)
           
protected  void releaseModelSet()
           
protected  void removeUnnecessaryBonds(Atom atom, boolean deleteAtom)
           
 void resetAromatic()
           
protected  void resetMolecules()
           
protected  Bond setBond(int index, Bond bond)
           
 java.util.BitSet setBondOrder(int bondIndex, char type)
           
 
Methods inherited from class org.jmol.modelset.AtomCollection
calculateHydrogens, calculateSurface, calculateVolume, clearBfactorRange, deleteModelAtoms, fillAtomData, findAtomsInRectangle, findMaxRadii, findNearestAtomIndex, getAtomChain, getAtomColix, getAtomCount, getAtomicCharges, getAtomicPropertyState, getAtomicPropertyState, getAtomIndexFromAtomNumber, getAtomIndices, getAtomInfo, getAtomInfoXYZ, getAtomModelIndex, getAtomName, getAtomNumber, getAtomPoint3f, getAtomPointVector, getAtomRadius, getAtomSequenceCode, getAtomsWithin, getAtomsWithin, getAtomTypes, getAtomVdwRadius, getBfactor100Hi, getBfactor100Lo, getBFactors, getChainBits, getChimeInfo, getClickableSet, getElementName, getElementNumber, getElementSymbol, getEllipsoid, getHaveStraightness, getHelixData, getHybridizationAndAxes, getHydrophobicity, getImplicitHydrogenCount, getIonicRadii, getMaxVanderwaalsRadius, getPartialCharges, getQuaternion, getRadiusVdwJmol, getSeqcodeBits, getSurfaceDistance100, getSurfaceDistanceMax, getTaintedAtoms, getUserSettableType, getVibrationCoord, getVibrationVector, getVisibleSet, isAtomHidden, isCursorOnTopOf, mergeAtomArrays, modelSetHasVibrationVectors, setAtomCoord, setAtomCoord, setAtomCoordRelative, setAtomCoordRelative, setAtomData, setAtomName, setAtomNumber, setAtomProperty, setAtomType, setBFactor, setBsHidden, setElement, setEllipsoid, setFormalCharges, setHaveStraightness, setHydrophobicity, setIonicRadius, setOccupancy, setPartialCharge, setPreserveState, setTaintedAtoms, setVibrationVector, taint, taint, unTaintAtoms, validateBspf, validateBspf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

molecules

protected JmolMolecule[] molecules

moleculeCount

protected int moleculeCount

bonds

protected Bond[] bonds

bondCount

protected int bondCount

BOND_GROWTH_INCREMENT

protected static final int BOND_GROWTH_INCREMENT
See Also:
Constant Field Values

MAX_BONDS_LENGTH_TO_CACHE

protected static final int MAX_BONDS_LENGTH_TO_CACHE
See Also:
Constant Field Values

MAX_NUM_TO_CACHE

protected static final int MAX_NUM_TO_CACHE
See Also:
Constant Field Values

numCached

protected int[] numCached

freeBonds

protected Bond[][][] freeBonds

bsHBondsRasmol

protected java.util.BitSet bsHBondsRasmol

haveWarned

private boolean haveWarned

defaultCovalentMad

protected short defaultCovalentMad

bsAromaticSingle

private java.util.BitSet bsAromaticSingle

bsAromaticDouble

private java.util.BitSet bsAromaticDouble

bsAromatic

protected java.util.BitSet bsAromatic

haveHiddenBonds

protected boolean haveHiddenBonds
Constructor Detail

BondCollection

public BondCollection()
Method Detail

releaseModelSet

protected void releaseModelSet()
Overrides:
releaseModelSet in class AtomCollection

resetMolecules

protected void resetMolecules()

getBonds

public Bond[] getBonds()

getBondAt

public Bond getBondAt(int bondIndex)

getBondCount

public int getBondCount()

getBondIterator

public BondIterator getBondIterator(int bondType,
                                    java.util.BitSet bsSelected)

getBondIterator

public BondIterator getBondIterator(java.util.BitSet bsSelected)

getBondAtom1

public Atom getBondAtom1(int i)

getBondAtom2

public Atom getBondAtom2(int i)

getBondRadius

public float getBondRadius(int i)

getBondOrder

public int getBondOrder(int i)

getBondColix1

public short getBondColix1(int i)

getBondColix2

public short getBondColix2(int i)

getBondModelIndex

public int getBondModelIndex(int i)

getBondCountInModel

protected int getBondCountInModel(int modelIndex)
for general use

Parameters:
modelIndex - the model of interest or -1 for all
Returns:
the actual number of connections

getBondsForSelectedAtoms

public java.util.BitSet getBondsForSelectedAtoms(java.util.BitSet bsAtoms,
                                                 boolean bondSelectionModeOr)

bondAtoms

public Bond bondAtoms(Atom atom1,
                      Atom atom2,
                      int order,
                      short mad,
                      java.util.BitSet bsBonds,
                      float energy,
                      boolean addGroup,
                      boolean isNew)

getOrAddBond

private Bond getOrAddBond(Atom atom,
                          Atom atomOther,
                          int order,
                          short mad,
                          java.util.BitSet bsBonds,
                          float energy,
                          boolean overrideBonding)

setBond

protected Bond setBond(int index,
                       Bond bond)

bondMutually

protected Bond bondMutually(Atom atom,
                            Atom atomOther,
                            int order,
                            short mad,
                            float energy)

addBondToAtom

private void addBondToAtom(Atom atom,
                           Bond bond)

addToBonds

private Bond[] addToBonds(Bond newBond,
                          Bond[] oldBonds)

getRasmolHydrogenBonds

void getRasmolHydrogenBonds(Model m,
                            java.util.BitSet bsA,
                            java.util.BitSet bsB,
                            java.util.List<Bond> vHBonds,
                            boolean nucleicOnly,
                            int nMax,
                            boolean dsspIgnoreHydrogens)

addHBond

protected int addHBond(Atom atom1,
                       Atom atom2,
                       int order,
                       float energy)

getBondOrder

protected static short getBondOrder(float bondingRadiusA,
                                    float bondingRadiusB,
                                    float distance2,
                                    float minBondDistance2,
                                    float bondTolerance)

checkValencesAndBond

protected boolean checkValencesAndBond(Atom atomA,
                                       Atom atomB,
                                       int order,
                                       short mad,
                                       java.util.BitSet bsBonds)

deleteAllBonds

protected void deleteAllBonds()

getDefaultMadFromOrder

public short getDefaultMadFromOrder(int order)
When creating a new bond, determine bond diameter from order

Parameters:
order -
Returns:
if hydrogen bond, default to 1; otherwise 0 (general default)

deleteConnections

protected int[] deleteConnections(float minDistance,
                                  float maxDistance,
                                  int order,
                                  java.util.BitSet bsA,
                                  java.util.BitSet bsB,
                                  boolean isBonds,
                                  boolean matchNull,
                                  float minDistanceSquared,
                                  float maxDistanceSquared)

deleteBonds

public void deleteBonds(java.util.BitSet bsBond,
                        boolean isFullModel)

resetAromatic

public void resetAromatic()

assignAromaticBonds

public void assignAromaticBonds()

assignAromaticBonds

protected void assignAromaticBonds(boolean isUserCalculation,
                                   java.util.BitSet bsBonds)
algorithm discussed above.

Parameters:
isUserCalculation - if set, don't reset the base aromatic bitset and do report changes to STICKS as though this were a bondOrder command.
bsBonds - passed to us by autoBond routine

assignAromaticDouble

private boolean assignAromaticDouble(Bond bond)
try to assign AROMATICDOUBLE to this bond. Each atom needs to be have all single bonds except for this one.

Parameters:
bond -
Returns:
true if successful; false otherwise

assignAromaticSingle

private boolean assignAromaticSingle(Bond bond)
try to assign AROMATICSINGLE to this bond. Each atom needs to be able to have one aromatic double bond attached.

Parameters:
bond -
Returns:
true if successful; false otherwise

assignAromaticSingle

private boolean assignAromaticSingle(Atom atom,
                                     int notBondIndex)
N atoms with 3 bonds cannot also have a double bond; other atoms needs all single bonds, because the bond leading up to it is double.

Parameters:
atom -
notBondIndex - that index of the bond leading to this atom --- to be ignored
Returns:
true if successful, false if not

assignAromaticDouble

private boolean assignAromaticDouble(Atom atom)
N atoms with 3 bonds cannot also have a double bond; other atoms need one and only one double bond; the rest must be single bonds.

Parameters:
atom -
Returns:
true if successful, false if not

assignAromaticSingleHetero

private boolean assignAromaticSingleHetero(Atom atom)

assignAromaticNandO

private void assignAromaticNandO(java.util.BitSet bsSelected)

getAtomBitsMaybeDeleted

protected java.util.BitSet getAtomBitsMaybeDeleted(int tokType,
                                                   java.lang.Object specInfo)
Description copied from class: AtomCollection
general unqualified lookup of atom set type

Overrides:
getAtomBitsMaybeDeleted in class AtomCollection
Returns:
BitSet; or null if we mess up the type

setBondOrder

public java.util.BitSet setBondOrder(int bondIndex,
                                     char type)

removeUnnecessaryBonds

protected void removeUnnecessaryBonds(Atom atom,
                                      boolean deleteAtom)

displayBonds

public void displayBonds(Bond.BondSet bs,
                         boolean isDisplay)