Class: Bond

Kekule. Bond

new Bond(id, connectedObjs, bondOrder, electronCount, bondType)

Implements the concept of a covalent bond between two or more atoms. A bond is considered to be a number of electrons connecting two or more of atoms.
Parameters:
Name Type Description
id String Id of this node.
connectedObjs Array Objects connected by connector, usually a connector connects two nodes.
bondOrder Int Order of bond. Usually electronCount / 2.
electronCount Float Count of electrons in this set.
bondType String Type of bond, value from Kekule.BondType.
Properties:
Name Type Description
bondForm Kekule.BondForm Form of bond, single, double or other.
bondType String Type of bond, value from Kekule.BondType.
bondOrder Num Order of bond. Values should be retrieved from Kekule.BondOrder.
bondValence Num Valence comsumed of an atom to connect to this bond. Note this value is different from Kekule.Bond#bondOrder, For example, bondOrder value for Kekule.BondOrder.EXPLICIT_AROMATIC is 10, but the valence is 1.5. This property is read only.
electronCount Float Count of electrons in this set. Note that there may be partial electron in set, so a float value is used here.
stereo Int Stereo type of bond.
isInAromaticRing Bool A flag to indicate the bond is in a aromatic ring and is a aromatic bond. User should not set this property directly, instead, this value will be marked in aromatic detection routine.
Source:

Extends

Methods

appendConnectedObj(obj)

Add a object to connectedObjs array. If obj already in connectedObjs, nothing will be done.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

appendLinkedConnector(connector)

Link a connector to this node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

assertConnectedObjLegal(obj) → {Bool}

Check if an obj can be added to connectedObjs array. Generally, an object with same owner of current connector can be added. If not so, a exception will be raised.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Bool

clearConnectedObjs()

Clear all connected objects.
Inherited From:
Source:

compareStructure(targetObj, options) → {Int}

Explicit set compare method to chem structure and compare to targetObj.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Int

equalStructure(targetObj, options) → {Bool}

Check if this object and targetObj has equivalent chem structure.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Bool

getAbsBaseCoord(coordMode) → {Hash}

Get center absolute coord of object.
Parameters:
Name Type Description
coordMode Int
Bool
Inherited From:
Source:
Returns:
Type
Hash

getAllAutoScaleRefLengths(coordMode, allowCoordBorrow) → {Array}

Returns all length factors in object to help the scale ratio in autoscale mode. To molecule, typically this is the all of bond lengths. If no length can be found in this object, [] will be returned.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Array

getBaseCoord(coordMode, allowCoordBorrow) → {Hash}

Get center coord of object. Param coordMode determinate which coord (2D or 3D) will be returned.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Hash

getBelongedRingMinSize() → {Int}

Returns the min size of all belonged rings.
Inherited From:
Source:
Returns:
Min ring node count. If the object is not belonged to any ring, null will be returned.
Type
Int

getBelongedSssrRings() → {Array}

Returns SSSR ring that this object belonged.
Inherited From:
Source:
Returns:
Type
Array

getConnectedChemNodeCount() → {Int}

Get count of connected chem nodes.
Inherited From:
Source:
Returns:
Type
Int

getConnectedExposedObjs() → {Array}

Returns only connected objects exposed to renderer.
Inherited From:
Source:
Returns:
Type
Array

getConnectedNonHydrogenObjs() → {Array}

Returns connected objects except hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getConnectedObjAt(index) → {Kekule.ChemStructureObject}

Get connectedObj at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getConnectedObjCount() → {Int}

Get count of connected objects.
Inherited From:
Source:
Returns:
Type
Int

getConnectedSiblings() → {Array}

Returns connected objects with the same parent of this connector. For example, connector connected to a child node in subgroup, then the subgroup rather than the child node will be returned.
Inherited From:
Source:
Returns:
Type
Array

getConnectorTo(obj) → {Kekule.ChemStructureConnector}

Get connector between this object and another object.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureConnector

getCoordDependentObjects() → {Array}

If coord is calculated from other objects, this function will return them.
Inherited From:
Source:
Returns:
Type
Array

getCoordDeterminateObjects() → {Array}

If this object determinate other object's coord, this method should returns them.
Inherited From:
Source:
Returns:
Type
Array

getCurrConnectableObj() → {Kekule.ChemStructureObject}

Returns self or child object that can directly linked to a connector. For atom or other simple chem objetc, this function should just returns self, for structure fragment, this function need to returns an anchor node.
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getLength(coordMode, allowCoordBorrow) → {Float}

Return distance between two connected object. If more than two objects are connected, this function will return null.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Float

getLength2D(allowCoordBorrow) → {Float}

Return 2D distance between two connected object. If more than two objects are connected, this function will return null.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Float

getLength3D(allowCoordBorrow) → {Float}

Return 3D distance between two connected object. If more than two objects are connected, this function will return null.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Float

getLinkedConnectorAt(index) → {Kekule.ChemStructureConnector}

Get linked connector object at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureConnector

getLinkedConnectorCount() → {Int}

Return count of linkedConnectors.
Inherited From:
Source:
Returns:
Type
Int

getLinkedHydrogenAtoms() → {Array}

Returns linked hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenConnectors() → {Array}

Returns connectors that connected to a non hydrogen node.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenObjs() → {Array}

Returns linked objects except hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedObjsOnConnector() → {Array}

Returns other objects connected to this one through connector.
Inherited From:
Source:
Returns:
Type
Array

getParentFragment() → {Kekule.StructureFragment}

If Kekule.ChemStructureObject#parent is a Kekule.StructureFragment, returns this fragment.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

getRootFragment() → {Kekule.StructureFragment}

Returns the root parent of Kekule.StructureFragment, rather than subgroups.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

hasConnectedObj(obj)

Check if a object is connected with this connector.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

indexOfConnectedObj(obj) → {Int}

Get index of obj in connectedObjs array.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Int

indexOfLinkedConnector(connector) → {Int}

Returns index of connector connected to node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:
Returns:
Type
Int

insertConnectedObjAt(obj, index)

Insert obj at index of connectedObjs array. If index is not set, obj will be put as the first obj.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
index Int
Inherited From:
Source:

isAromatic() → {Bool}

Returns if bond is a aromatic one.
Source:
Returns:
Type
Bool

isBondBetween(atomicNumberOrSymbol1, atomicNumberOrSymbol2) → {Bool}

Check if this bond is between two specified atoms.
Parameters:
Name Type Description
atomicNumberOrSymbol1 Variant
atomicNumberOrSymbol2 Variant
Source:
Returns:
Type
Bool

isConnectingConnector()

Check if this connector connected to another connector (e.g, bond ends with another bond).
Inherited From:
Source:

isConnectingWithObj(obj)

Check if a object is connected with this connector. Same as Kekule.ChemStructureConnector#hasConnectedObj
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

isCoordDependent() → {Bool}

Whether the coord of chem object is not calculated from other object (like connector).
Inherited From:
Source:
Returns:
Type
Bool

isDoubleBond() → {Bool}

Returns if bond is a double covalence bond.
Source:
Returns:
Type
Bool

isNormalConnectorToHydrogen() → {Bool}

Whether this connector connect hydrogen atom to another node.
Inherited From:
Source:
Returns:
Type
Bool

isSingleBond() → {Bool}

Returns if bond is a single covalence bond.
Source:
Returns:
Type
Bool

isTripleBond() → {Bool}

Returns if bond is a triple covalence bond.
Source:
Returns:
Type
Bool

move(delta, coordMode)

Move connector by delta. Actually this action will move all nodes connected with this connector.
Parameters:
Name Type Description
delta Hash
coordMode Int
Inherited From:
Source:

move2D(delta) → {Hash}

Move connector 2D coord by delta.
Parameters:
Name Type Description
delta Hash
Inherited From:
Source:
Returns:
New coord after moving.
Type
Hash

move3D(delta) → {Hash}

Move connector 3D coord by delta.
Parameters:
Name Type Description
delta Hash
Inherited From:
Source:
Returns:
New coord after moving.
Type
Hash

normalizeDirection()

Turn bond direction to a normal up or down one (not up_inverted or down_inverted).
Source:

removeConnectedObj(obj)

Remove a object in connectedObjs property.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeConnectedObjAt(index)

Remove object at index in connectedObjs property.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeLinkedConnector(connector)

Remove a connector in linkedContainer.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

removeLinkedConnectorAt(index)

Remove connector at index of linkedConnectors.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeThisFromConnectedObjs()

Remove this connector from all linked objects. Ths method should be called before a connector is removed from a structure.
Inherited From:
Source:

removeThisFromLinkedConnector()

Remove this node from all linked connectors. Ths method should be called before a object is removed from a structure.
Inherited From:
Source:

replaceConnectedObj(oldObj, newObj)

Replace old connected object with new one and remove connection to old object.
Parameters:
Name Type Description
oldObj Kekule.ChemStructureObject
newObj Kekule.ChemStructureObject
Inherited From:
Source:

setAbsBaseCoord(value, coordMode)

Set absolute center coord of connector. Actually mode all conntected nodes.
Parameters:
Name Type Description
value Hash
coordMode Int
Inherited From:
Source:

setConnectedObjAt(index, value)

Set connectedObj at index.
Parameters:
Name Type Description
index Int
value Kekule.ChemStructureObject
Inherited From:
Source:

sortConnectedObjs(compareFunc)

Sort the array of connected objs.
Parameters:
Name Type Description
compareFunc function
Inherited From:
Source:

Events

structureChange

Invoked when object is changed and the change is related with structure (e.g. modify a bond, change a atomic number...). Event has field: {origin: the change source object (may be a child of event.target}.
Inherited From:
Source:

Kekule. Bond

new Bond()

Source:

Methods

appendConnectedObj(obj)

Add a object to connectedObjs array. If obj already in connectedObjs, nothing will be done.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

appendLinkedConnector(connector)

Link a connector to this node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

assertConnectedObjLegal(obj) → {Bool}

Check if an obj can be added to connectedObjs array. Generally, an object with same owner of current connector can be added. If not so, a exception will be raised.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Bool

clearConnectedObjs()

Clear all connected objects.
Inherited From:
Source:

compareStructure(targetObj, options) → {Int}

Explicit set compare method to chem structure and compare to targetObj.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Int

equalStructure(targetObj, options) → {Bool}

Check if this object and targetObj has equivalent chem structure.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Bool

getAbsBaseCoord(coordMode) → {Hash}

Get center absolute coord of object.
Parameters:
Name Type Description
coordMode Int
Bool
Inherited From:
Source:
Returns:
Type
Hash

getAllAutoScaleRefLengths(coordMode, allowCoordBorrow) → {Array}

Returns all length factors in object to help the scale ratio in autoscale mode. To molecule, typically this is the all of bond lengths. If no length can be found in this object, [] will be returned.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Array

getBaseCoord(coordMode, allowCoordBorrow) → {Hash}

Get center coord of object. Param coordMode determinate which coord (2D or 3D) will be returned.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Hash

getBelongedRingMinSize() → {Int}

Returns the min size of all belonged rings.
Inherited From:
Source:
Returns:
Min ring node count. If the object is not belonged to any ring, null will be returned.
Type
Int

getBelongedSssrRings() → {Array}

Returns SSSR ring that this object belonged.
Inherited From:
Source:
Returns:
Type
Array

getConnectedChemNodeCount() → {Int}

Get count of connected chem nodes.
Inherited From:
Source:
Returns:
Type
Int

getConnectedExposedObjs() → {Array}

Returns only connected objects exposed to renderer.
Inherited From:
Source:
Returns:
Type
Array

getConnectedNonHydrogenObjs() → {Array}

Returns connected objects except hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getConnectedObjAt(index) → {Kekule.ChemStructureObject}

Get connectedObj at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getConnectedObjCount() → {Int}

Get count of connected objects.
Inherited From:
Source:
Returns:
Type
Int

getConnectedSiblings() → {Array}

Returns connected objects with the same parent of this connector. For example, connector connected to a child node in subgroup, then the subgroup rather than the child node will be returned.
Inherited From:
Source:
Returns:
Type
Array

getConnectorTo(obj) → {Kekule.ChemStructureConnector}

Get connector between this object and another object.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureConnector

getCoordDependentObjects() → {Array}

If coord is calculated from other objects, this function will return them.
Inherited From:
Source:
Returns:
Type
Array

getCoordDeterminateObjects() → {Array}

If this object determinate other object's coord, this method should returns them.
Inherited From:
Source:
Returns:
Type
Array

getCurrConnectableObj() → {Kekule.ChemStructureObject}

Returns self or child object that can directly linked to a connector. For atom or other simple chem objetc, this function should just returns self, for structure fragment, this function need to returns an anchor node.
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getLength(coordMode, allowCoordBorrow) → {Float}

Return distance between two connected object. If more than two objects are connected, this function will return null.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Float

getLength2D(allowCoordBorrow) → {Float}

Return 2D distance between two connected object. If more than two objects are connected, this function will return null.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Float

getLength3D(allowCoordBorrow) → {Float}

Return 3D distance between two connected object. If more than two objects are connected, this function will return null.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Float

getLinkedConnectorAt(index) → {Kekule.ChemStructureConnector}

Get linked connector object at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureConnector

getLinkedConnectorCount() → {Int}

Return count of linkedConnectors.
Inherited From:
Source:
Returns:
Type
Int

getLinkedHydrogenAtoms() → {Array}

Returns linked hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenConnectors() → {Array}

Returns connectors that connected to a non hydrogen node.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenObjs() → {Array}

Returns linked objects except hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedObjsOnConnector() → {Array}

Returns other objects connected to this one through connector.
Inherited From:
Source:
Returns:
Type
Array

getParentFragment() → {Kekule.StructureFragment}

If Kekule.ChemStructureObject#parent is a Kekule.StructureFragment, returns this fragment.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

getRootFragment() → {Kekule.StructureFragment}

Returns the root parent of Kekule.StructureFragment, rather than subgroups.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

hasConnectedObj(obj)

Check if a object is connected with this connector.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

indexOfConnectedObj(obj) → {Int}

Get index of obj in connectedObjs array.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Int

indexOfLinkedConnector(connector) → {Int}

Returns index of connector connected to node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:
Returns:
Type
Int

insertConnectedObjAt(obj, index)

Insert obj at index of connectedObjs array. If index is not set, obj will be put as the first obj.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
index Int
Inherited From:
Source:

isAromatic() → {Bool}

Returns if bond is a aromatic one.
Source:
Returns:
Type
Bool

isBondBetween(atomicNumberOrSymbol1, atomicNumberOrSymbol2) → {Bool}

Check if this bond is between two specified atoms.
Parameters:
Name Type Description
atomicNumberOrSymbol1 Variant
atomicNumberOrSymbol2 Variant
Source:
Returns:
Type
Bool

isConnectingConnector()

Check if this connector connected to another connector (e.g, bond ends with another bond).
Inherited From:
Source:

isConnectingWithObj(obj)

Check if a object is connected with this connector. Same as Kekule.ChemStructureConnector#hasConnectedObj
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

isCoordDependent() → {Bool}

Whether the coord of chem object is not calculated from other object (like connector).
Inherited From:
Source:
Returns:
Type
Bool

isDoubleBond() → {Bool}

Returns if bond is a double covalence bond.
Source:
Returns:
Type
Bool

isNormalConnectorToHydrogen() → {Bool}

Whether this connector connect hydrogen atom to another node.
Inherited From:
Source:
Returns:
Type
Bool

isSingleBond() → {Bool}

Returns if bond is a single covalence bond.
Source:
Returns:
Type
Bool

isTripleBond() → {Bool}

Returns if bond is a triple covalence bond.
Source:
Returns:
Type
Bool

move(delta, coordMode)

Move connector by delta. Actually this action will move all nodes connected with this connector.
Parameters:
Name Type Description
delta Hash
coordMode Int
Inherited From:
Source:

move2D(delta) → {Hash}

Move connector 2D coord by delta.
Parameters:
Name Type Description
delta Hash
Inherited From:
Source:
Returns:
New coord after moving.
Type
Hash

move3D(delta) → {Hash}

Move connector 3D coord by delta.
Parameters:
Name Type Description
delta Hash
Inherited From:
Source:
Returns:
New coord after moving.
Type
Hash

normalizeDirection()

Turn bond direction to a normal up or down one (not up_inverted or down_inverted).
Source:

removeConnectedObj(obj)

Remove a object in connectedObjs property.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeConnectedObjAt(index)

Remove object at index in connectedObjs property.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeLinkedConnector(connector)

Remove a connector in linkedContainer.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

removeLinkedConnectorAt(index)

Remove connector at index of linkedConnectors.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeThisFromConnectedObjs()

Remove this connector from all linked objects. Ths method should be called before a connector is removed from a structure.
Inherited From:
Source:

removeThisFromLinkedConnector()

Remove this node from all linked connectors. Ths method should be called before a object is removed from a structure.
Inherited From:
Source:

replaceConnectedObj(oldObj, newObj)

Replace old connected object with new one and remove connection to old object.
Parameters:
Name Type Description
oldObj Kekule.ChemStructureObject
newObj Kekule.ChemStructureObject
Inherited From:
Source:

setAbsBaseCoord(value, coordMode)

Set absolute center coord of connector. Actually mode all conntected nodes.
Parameters:
Name Type Description
value Hash
coordMode Int
Inherited From:
Source:

setConnectedObjAt(index, value)

Set connectedObj at index.
Parameters:
Name Type Description
index Int
value Kekule.ChemStructureObject
Inherited From:
Source:

sortConnectedObjs(compareFunc)

Sort the array of connected objs.
Parameters:
Name Type Description
compareFunc function
Inherited From:
Source:

Events

structureChange

Invoked when object is changed and the change is related with structure (e.g. modify a bond, change a atomic number...). Event has field: {origin: the change source object (may be a child of event.target}.
Inherited From:
Source: