# Class BondCollection

java.lang.Object
org.jmol.modelset.AtomCollection
org.jmol.modelset.BondCollection

Direct Known Subclasses:
  `ModelSet`

public abstract class BondCollection extends AtomCollection

## Nested Class Summary

### Nested classes/interfaces inherited from class AtomCollection

`AtomCollection.AtomSorter`

## Field Summary

Fields
Modifier and Type
Field
Description
`Bond[]`
`bo`
`protected static final int`
`BOND_GROWTH_INCREMENT`
`int`
`bondCount`
`protected BS`
`bsAromatic`
`protected short`
`defaultCovalentMad`
`protected Bond[][][]`
`freeBonds`
`protected boolean`
`haveAtropicBonds`
`boolean`
`haveHiddenBonds`
`protected static final int`
`MAX_BONDS_LENGTH_TO_CACHE`
`protected static final int`
`MAX_NUM_TO_CACHE`
`protected int`
`moleculeCount`
`protected JmolMolecule[]`
`molecules`
`protected int[]`
`numCached`
`protected V3`
`v1`
`protected V3`
`v2`

### Fields inherited from class AtomCollection

`ac, at, atomTensorList, atomTensors, bioModelset, bsClickable, bsModulated, bsPartialCharges, bspf, bsVisible, CALC_H_ALLOW_H, CALC_H_DOALL, CALC_H_HAVEH, CALC_H_IGNORE_H, CALC_H_JUSTC, CALC_H_QUICK, canSkipLoad, g3d, haveChirality, haveStraightness, maxBondingRadius, occupancies, pointGroup, preserveState, surfaceDistance100s, TAINT_ATOMNAME, TAINT_ATOMNO, TAINT_ATOMTYPE, TAINT_BONDINGRADIUS, TAINT_CHAIN, TAINT_COORD, TAINT_ELEMENT, TAINT_FORMALCHARGE, TAINT_HYDROPHOBICITY, TAINT_MAX, TAINT_OCCUPANCY, TAINT_PARTIALCHARGE, TAINT_RESNO, TAINT_SEQID, TAINT_SITE, TAINT_TEMPERATURE, TAINT_VALENCE, TAINT_VANDERWAALS, TAINT_VIBRATION, tainted, trajectory, userSettableValues, vib, vibrations, vwr`

## Constructor Summary

Constructors
Constructor
Description
`BondCollection()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addConnectedHAtoms(Atom atom, BS bsAtoms)`
`int`
`addHBond(Atom atom1, Atom atom2, int order, float energy)`
/// bonding methods //////
`protected boolean`
`allowAromaticBond(Bond b)`
`void`
`assignAromaticBondsBs(boolean isUserCalculation, BS bsBonds)`
algorithm discussed above.
`Bond`
`bondAtoms(Atom atom1, Atom atom2, int order, short mad, BS bsBonds, float energy, boolean addGroup, boolean isNew)`
`protected Bond`
`bondMutually(Atom atom, Atom atomOther, int order, short mad, float energy)`
`protected void`
`dBb(BS bsBond, boolean isFullModel)`
Delete bonds, but don't shift arrays, just set bond to null, in order to allow for state.
`protected void`
`deleteAllBonds2()`
`protected int[]`
`deleteConnections(float minD, float maxD, int order, BS bsA, BS bsB, boolean isBonds, boolean matchNull)`
`void`
`displayBonds(BondSet bs, boolean isDisplay)`
`protected float`
`fixD(float d, boolean isF)`
`protected BS`
`getAtomBitsMDb(int tokType, Object specInfo)`
`BS`
`getAtomsConnected(float min, float max, int intType, BS bs)`
`short`
`getBondColix1(int i)`
`short`
`getBondColix2(int i)`
`protected int`
`getBondCountInModel(int modelIndex)`
for general use
`BondIterator`
`getBondIterator(BS bsBonds)`
`BondIterator`
`getBondIteratorForType(int bondType, BS bsAtoms)`
`BS`
`getBondsForSelectedAtoms(BS bsAtoms, boolean bondSelectionModeOr)`
`short`
`getDefaultMadFromOrder(int order)`
When creating a new bond, determine bond diameter from order
`protected Bond`
`getOrAddBond(Atom atom, Atom atomOther, int order, short mad, BS bsBonds, float energy, boolean overrideBonding)`
`protected boolean`
`isInRange(Atom atom1, Atom atom2, float minD, float maxD, boolean minFrac, boolean maxfrac, boolean isFractional)`
Consider the min/max option for CONNECT
`protected void`
`releaseModelSetBC()`
`void`
`removeUnnecessaryBonds(Atom atom, boolean deleteAtom)`
`void`
`resetAromatic()`
`protected Bond`
`setBond(int index, Bond bond)`
`protected void`
`setupBC()`

### Methods inherited from class AtomCollection

`addTensor, calculateHydrogens, calculateSurface, calculateVolume, chainToUpper, clearBfactorRange, clearVisibleSets, deleteModelAtoms, fillADa, findMaxRadii, findNearest2, fixFormalCharges, generateCrystalClass, getAllAtomTensors, getAtom, getAtomBitsMDa, getAtomicCharges, getAtomIdentityInfo, getAtomIndices, getAtomInfo, getAtomPointVector, getAtomsFromAtomNumberInFrame, getAtomsInFrame, getAtomsNearPlane, getAtomTensor, getAtomTensorList, getAtomTypes, getBfactor100Hi, getBfactor100Lo, getBFactors, getBondingRadii, getChainBits, getClickableSet, getElementName, getFirstAtomIndexFromAtomNumber, getHybridizationAndAxes, getHydrophobicity, getLabeler, getMaxVanderwaalsRadius, getMissingHydrogenCount, getModulation, getOccupancyFloat, getPartialCharges, getQuaternion, getRadiusVdwJmol, getSeqcodeBits, getSpecNameOrNull, getSurfaceDistanceMax, getTaintedAtoms, getUserSettableType, getVibCoord, getVibration, getVisibleSet, isAtomHidden, isDeleted, isModulated, mergeAtomArrays, modelSetHasVibrationVectors, releaseModelSetAC, scaleVectorsToMax, setAPa, setAtomCoord, setAtomCoord2, setAtomCoordRelative, setAtomData, setAtomName, setAtomNumber, setAtomsCoordRelative, setAtomTensors, setAtomVibrationVector, setBFactor, setBondingRadius, setBsHidden, setElement, setFormalCharges, setOccupancy, setPartialCharge, setPreserveState, setSite, setTaintedAtoms, setupAC, taintAtom, taintAtoms, unTaintAtoms, validateBspf`

### Methods inherited from class Object

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

## Field Details

### bo

public Bond[] bo

### bondCount

public int bondCount

### numCached

protected int[] numCached

### freeBonds

protected Bond[][][] freeBonds

### molecules

protected JmolMolecule[] molecules

### moleculeCount

protected int moleculeCount

### defaultCovalentMad

protected short defaultCovalentMad

### bsAromatic

protected BS bsAromatic

### haveHiddenBonds

public boolean haveHiddenBonds

### v1

protected V3 v1

### v2

protected V3 v2

### 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

### haveAtropicBonds

protected boolean haveAtropicBonds

## Constructor Details

### BondCollection

public BondCollection()

## Method Details

### setupBC

protected void setupBC()

### releaseModelSetBC

protected void releaseModelSetBC()

### getBondIteratorForType

public BondIterator getBondIteratorForType(int bondType, BS bsAtoms)

### getBondIterator

public BondIterator getBondIterator(BS bsBonds)

### getBondColix1

public short getBondColix1(int i)

### getBondColix2

public short getBondColix2(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 BS getBondsForSelectedAtoms(BS bsAtoms, boolean bondSelectionModeOr)

### bondAtoms

public Bond bondAtoms(Atom atom1, Atom atom2, int order, short mad, BS bsBonds, float energy, boolean addGroup, boolean isNew)

### getOrAddBond

protected Bond getOrAddBond(Atom atom, Atom atomOther, int order, short mad, BS 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)

### addHBond

public int addHBond(Atom atom1, Atom atom2, int order, float energy)
/// bonding methods //////

### deleteAllBonds2

protected void deleteAllBonds2()

### 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 minD, float maxD, int order, BS bsA, BS bsB, boolean isBonds, boolean matchNull)

### fixD

protected float fixD(float d, boolean isF)

### isInRange

protected boolean isInRange(Atom atom1, Atom atom2, float minD, float maxD, boolean minFrac, boolean maxfrac, boolean isFractional)
Consider the min/max option for CONNECT

Parameters:
  `atom1` -
  `atom2` -
  `minD` -
  `maxD` -
  `minFrac` -
  `maxfrac` -
  `isFractional` -
Returns:
  true if in range

### dBb

protected void dBb(BS bsBond, boolean isFullModel)
Delete bonds, but don't shift arrays, just set bond to null, in order to allow for state.

Parameters:
  `bsBond` -
  `isFullModel` -

### resetAromatic

public void resetAromatic()

### assignAromaticBondsBs

public void assignAromaticBondsBs(boolean isUserCalculation, BS 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

### allowAromaticBond

protected boolean allowAromaticBond(Bond b)

### getAtomBitsMDb

protected BS getAtomBitsMDb(int tokType, Object specInfo)

### removeUnnecessaryBonds

public void removeUnnecessaryBonds(Atom atom, boolean deleteAtom)

### displayBonds

public void displayBonds(BondSet bs, boolean isDisplay)

### getAtomsConnected

public BS getAtomsConnected(float min, float max, int intType, BS bs)

### addConnectedHAtoms

public void addConnectedHAtoms(Atom atom, BS bsAtoms)