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


Field Summary
(package private)  int bondCount
           
private static int bondGrowthIncrement
           
(package private)  Bond[] bonds
           
protected  java.util.BitSet bsAromatic
           
private  java.util.BitSet bsAromaticDouble
           
private  java.util.BitSet bsAromaticSingle
           
protected  java.util.BitSet bsPseudoHBonds
           
protected  short defaultCovalentMad
           
protected  Bond[][][] freeBonds
           
private  boolean haveWarned
           
private  float hbondMax
           
private  float hbondMin
           
private  float hbondMin2
           
protected static int MAX_BONDS_LENGTH_TO_CACHE
           
protected static int MAX_NUM_TO_CACHE
           
protected  int[] numCached
           
 
Fields inherited from class org.jmol.modelset.AtomCollection
atomCount, atomNames, atoms, atomSerials, bfactor100s, bsEmpty, bsFoundRectangle, bspf, clientAtomReferences, ellipsoids, g3d, maxBondingRadius, occupancies, partialCharges, showRebondTimes, specialAtomIDs, surfaceDistance100s, TAINT_COORD, TAINT_MAX, tainted, vibrationVectors, viewer
 
Constructor Summary
BondCollection()
           
 
Method Summary
private  void addBondToAtom(Atom atom, Bond bond)
           
(package private)  void addHydrogenBond(Atom atom1, Atom atom2, short order, java.util.BitSet bsA, java.util.BitSet bsB)
          These are not actual hydrogen bonds.
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)
           
protected  int autoHbond(java.util.BitSet bsA, java.util.BitSet bsB, java.util.BitSet bsBonds)
           
 Bond bondAtoms(Atom atom1, Atom atom2, short order, short mad, java.util.BitSet bsBonds)
           
protected  Bond bondMutually(Atom atom, Atom atomOther, short order, short mad)
           
(package private)  boolean checkValencesAndBond(Atom atomA, Atom atomB, short order, short mad, java.util.BitSet bsBonds)
           
protected  void deleteAllBonds()
           
protected  void deleteBonds(java.util.BitSet bs)
           
protected  int[] deleteConnections(float minDistance, float maxDistance, short order, java.util.BitSet bsA, java.util.BitSet bsB, boolean isBonds, boolean matchNull, float minDistanceSquared, float maxDistanceSquared)
           
protected  java.util.BitSet getAtomBits(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(short bondType, java.util.BitSet bsSelected)
           
 int getBondModelIndex(int i)
           
protected  short getBondOrder(Atom atomA, float bondingRadiusA, Atom atomB, float bondingRadiusB, float distance2, float minBondDistance2, float bondTolerance)
           
 short getBondOrder(int i)
           
 float getBondRadius(int i)
           
 Bond[] getBonds()
           
 java.util.BitSet getBondsForSelectedAtoms(java.util.BitSet bsAtoms)
           
protected  java.util.BitSet getBondsForSelectedAtoms(java.util.BitSet bsAtoms, boolean bondSelectionModeOr)
           
protected  short getDefaultMadFromOrder(short order)
          When creating a new bond, determine bond diameter from order
private  Bond getOrAddBond(Atom atom, Atom atomOther, short order, short mad, java.util.BitSet bsBonds)
           
(package private)  void merge(ModelSet modelSet)
           
protected  void releaseModelSet()
           
 void resetAromatic()
           
protected  Bond setBond(int index, Bond bond)
           
 
Methods inherited from class org.jmol.modelset.AtomCollection
calculateSurface, clearBfactorRange, deleteAtoms, fillAtomData, findAtomsInRectangle, findMaxRadii, findNearestAtomIndex, getAdditionalHydrogens, getAtomAt, getAtomChain, getAtomColix, getAtomCount, getAtomCountInModel, getAtomicPropertyState, getAtomicPropertyState, getAtomIndexFromAtomNumber, getAtomIndices, getAtomInfo, getAtomInfoXYZ, getAtomModelIndex, getAtomName, getAtomNames, getAtomNumber, getAtomPoint3f, getAtomRadius, getAtoms, getAtomSequenceCode, getAtomsWithin, getAtomVdwRadius, getAtomX, getAtomY, getAtomZ, getBfactor100Hi, getBfactor100Lo, getBFactors, getChainBits, getChimeInfo, getClickableSet, getElementName, getElementNumber, getElementSymbol, getEllipsoid, getHybridizationAndAxes, getMaxVanderwaalsRadius, getModelBitSet, getPartialCharges, getQuaternion, getRadiusVdwJmol, getSeqcodeBits, getSurfaceDistance100, getSurfaceDistanceMax, getTaintedAtoms, getUserSettableType, getVibrationCoord, getVibrationVector, getVisibleSet, isAtomHidden, isAtomNameMatch, isCursorOnTopOf, isInLatticeCell, loadData, merge, modelSetHasVibrationVectors, setAtomCoord, setAtomCoord, setAtomCoordRelative, setAtomCoordRelative, setAtomProperty, setBFactor, setBsHidden, setEllipsoid, setFormalCharges, setOccupancy, setPartialCharge, setTaintedAtoms, setVibrationVector, taint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bonds

Bond[] bonds

bondCount

int bondCount

bondGrowthIncrement

private static final int bondGrowthIncrement
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

bsPseudoHBonds

protected java.util.BitSet bsPseudoHBonds

haveWarned

private boolean haveWarned

defaultCovalentMad

protected short defaultCovalentMad

hbondMax

private float hbondMax

hbondMin

private float hbondMin

hbondMin2

private float hbondMin2

bsAromaticSingle

private java.util.BitSet bsAromaticSingle

bsAromaticDouble

private java.util.BitSet bsAromaticDouble

bsAromatic

protected java.util.BitSet bsAromatic
Constructor Detail

BondCollection

public BondCollection()
Method Detail

releaseModelSet

protected void releaseModelSet()
Overrides:
releaseModelSet in class AtomCollection

merge

void merge(ModelSet modelSet)

getBonds

public Bond[] getBonds()

getBondAt

public Bond getBondAt(int bondIndex)

getBondCount

public int getBondCount()

getBondIterator

public BondIterator getBondIterator(short 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 short 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)

getBondsForSelectedAtoms

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

bondAtoms

public Bond bondAtoms(Atom atom1,
                      Atom atom2,
                      short order,
                      short mad,
                      java.util.BitSet bsBonds)

getOrAddBond

private Bond getOrAddBond(Atom atom,
                          Atom atomOther,
                          short order,
                          short mad,
                          java.util.BitSet bsBonds)

setBond

protected Bond setBond(int index,
                       Bond bond)

bondMutually

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

addBondToAtom

private void addBondToAtom(Atom atom,
                           Bond bond)

addToBonds

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

addHydrogenBond

void addHydrogenBond(Atom atom1,
                     Atom atom2,
                     short order,
                     java.util.BitSet bsA,
                     java.util.BitSet bsB)
These are not actual hydrogen bonds. They are N-O bonds in proteins and nucleic acids The method is called by AminoPolymer and NucleicPolymer methods, which are indirectly called by this.autoHbond

Parameters:
atom1 -
atom2 -
order -
bsA -
bsB -

getBondOrder

protected short getBondOrder(Atom atomA,
                             float bondingRadiusA,
                             Atom atomB,
                             float bondingRadiusB,
                             float distance2,
                             float minBondDistance2,
                             float bondTolerance)

checkValencesAndBond

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

deleteAllBonds

protected void deleteAllBonds()

getDefaultMadFromOrder

protected short getDefaultMadFromOrder(short 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,
                                  short order,
                                  java.util.BitSet bsA,
                                  java.util.BitSet bsB,
                                  boolean isBonds,
                                  boolean matchNull,
                                  float minDistanceSquared,
                                  float maxDistanceSquared)

deleteBonds

protected void deleteBonds(java.util.BitSet bs)

autoHbond

protected int autoHbond(java.util.BitSet bsA,
                        java.util.BitSet bsB,
                        java.util.BitSet bsBonds)

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)

getAtomBits

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

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