Class: Atom

Atom

new Atom(id, elemSymbolOrAtomicNumber, massNumber, coord2D, coord3D)

Represent an atom in chemical structure.
Parameters:
Name Type Description
id String Id of this node.
elemSymbolOrAtomicNumber Variant Element symbol (String) or atomic number (Int) of atom.
massNumber Int Isotope mass number of atom, can be null.
coord2D Object The 2D coordinates of node, {x, y}, can be null.
coord3D Object The 3D coordinates of node, {x, y, z}, can be null.
Properties:
Name Type Description
isotope Kekule.Isotope The isotope and element of atom.
symbol String The element symbol of atom.
atomicNumber Int The atomic number symbol of atom.
massNumber Int The isotope mass number symbol of atom.
atomType Hash The type if this atom, data is read from kekule.structGenAtomTypesData.js. Undefined or null means uncertain type.
hybridizationType Int Hybridization type (sp/sp2/sp3) of atom Undefined or null means uncertain type.
Source:

Extends

Methods

appendLinkedConnector(connector)

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

changeElement(symbolOrAtomicNumber)

Change atom isotope to new symbol / atmoic number
Parameters:
Name Type Description
symbolOrAtomicNumber Variant Symbol(String) or atomic number(Int) of element.
Source:

changeIsotope(symbolOrAtomicNumber, massNumber)

Change atom isotope to new symbol / atmoic number or new mass number
Parameters:
Name Type Description
symbolOrAtomicNumber Variant Symbol(String) or atomic number(Int) of element. If undefined is assigned, the old atomic number will be used.
massNumber Int Mass number of isotope.
Source:

changeMassNumber(massNumber)

Change atom mass number. The element will remains the same.
Parameters:
Name Type Description
massNumber Int Mass number of isotope.
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

fetchChargeMarker() → {Kekule.ChemMarker.ChemPropertyMarker}

Get charge marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
Inherited From:
Source:
Returns:
Type
Kekule.ChemMarker.ChemPropertyMarker

fetchRadicalMarker() → {Kekule.ChemMarker.ChemPropertyMarker}

Get radical marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
Inherited From:
Source:
Returns:
Type
Kekule.ChemMarker.ChemPropertyMarker

getAtomicMass() → {Float}

Returns exact mass of current atom.
Source:
Returns:
Type
Float

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

getContainerBox(coordMode, allowCoordBorrow) → {Hash}

Calculate the box to contain the object. Descendants may override this method.
Parameters:
Name Type Description
coordMode Int Determine to calculate 2D or 3D box. Value from Kekule.CoordMode.
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getContainerBox2D(allowCoordBorrow) → {Hash}

Calculate the 2D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getContainerBox3D(allowCoordBorrow) → {Hash}

Calculate the 3D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

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

getHydrogenCount(includingBondedHydrogen)

If explicitHydrogenCount is set, returns it, else returns implicit hydrogen count.
Parameters:
Name Type Description
includingBondedHydrogen Bool
Source:

getImplicitHydrogenCount() → {Int}

If Kekule.Atom#explicitHydrogenCount is not set, use this function to retrieve count implicit hydrogens.
Source:
Returns:
Implicit hydrogen count.
Type
Int

getImplicitValence()

Guess and returns the implicit valence of atom.
Source:

getLinkedBonds(bondType) → {Array}

Returns linked instances of Kekule.Bond to this node.
Parameters:
Name Type Description
bondType Int
Inherited From:
Source:
Returns:
Type
Array

getLinkedChemNodes(ignoreHydrogenAtoms) → {Array}

Returns neighbor nodes linked to this node through proper connectors.
Parameters:
Name Type Description
ignoreHydrogenAtoms Bool Whether explicit hydrogen atoms are returned. Default is false.
Inherited From:
Source:
Returns:
Type
Array

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

getLinkedDoubleBonds() → {Array}

Returns linked double covalent bond to this node.
Inherited From:
Source:
Returns:
Type
Array

getLinkedHydrogenAtoms() → {Array}

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

getLinkedMultipleBonds() → {Array}

Returns linked multiple covalent bond to this node.
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

getProximalAtomType() → {Hash}

Returns explicit atom type when property Kekule.Atom@atomType is set, or a guessed atom type.
Source:
Returns:
Atom type JSON object from kekule.structGenAtomTypesData.js
Type
Hash

getRootFragment() → {Kekule.StructureFragment}

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

guessAtomType()

If the atomType property is not set explicitly, use this function to guess the atom type. returns {Object} Atom type JSON object from kekule.structGenAtomTypesData.js
Source:

indexOfLinkedConnector(connector) → {Int}

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

isElement(symbolOrAtomicNumber)

Check if current atom is a certain element.
Parameters:
Name Type Description
symbolOrAtomicNumber Variant Symbol(String) or atomic number(Int) of element.
Source:

isNormalAtom()

Check if this is a normal atom (not a pseudo one or unset one)
Source:

isSaturated() → {Bool}

Returns whether this atom is a saturated one.
Inherited From:
Source:
Returns:
Type
Bool

mayContainElement(atomicNumberOrSymbol) → {Bool}

Returns when this node is an atom of certain element or maybe or may include element (peusdo atom or atom list).
Parameters:
Name Type Description
atomicNumberOrSymbol Variant
Inherited From:
Source:
Returns:
Type
Bool

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:

removeThisFromLinkedConnector()

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

setHydrogenCount(value)

Same as setExplicitHydrogenCount.
Parameters:
Name Type Description
value Int
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:

Atom

new Atom()

Source:

Methods

appendLinkedConnector(connector)

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

changeElement(symbolOrAtomicNumber)

Change atom isotope to new symbol / atmoic number
Parameters:
Name Type Description
symbolOrAtomicNumber Variant Symbol(String) or atomic number(Int) of element.
Source:

changeIsotope(symbolOrAtomicNumber, massNumber)

Change atom isotope to new symbol / atmoic number or new mass number
Parameters:
Name Type Description
symbolOrAtomicNumber Variant Symbol(String) or atomic number(Int) of element. If undefined is assigned, the old atomic number will be used.
massNumber Int Mass number of isotope.
Source:

changeMassNumber(massNumber)

Change atom mass number. The element will remains the same.
Parameters:
Name Type Description
massNumber Int Mass number of isotope.
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

fetchChargeMarker() → {Kekule.ChemMarker.ChemPropertyMarker}

Get charge marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
Inherited From:
Source:
Returns:
Type
Kekule.ChemMarker.ChemPropertyMarker

fetchRadicalMarker() → {Kekule.ChemMarker.ChemPropertyMarker}

Get radical marker of node. If no such a marker currently and canCreate is true, a new marker will be created.
Inherited From:
Source:
Returns:
Type
Kekule.ChemMarker.ChemPropertyMarker

getAtomicMass() → {Float}

Returns exact mass of current atom.
Source:
Returns:
Type
Float

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

getContainerBox(coordMode, allowCoordBorrow) → {Hash}

Calculate the box to contain the object. Descendants may override this method.
Parameters:
Name Type Description
coordMode Int Determine to calculate 2D or 3D box. Value from Kekule.CoordMode.
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getContainerBox2D(allowCoordBorrow) → {Hash}

Calculate the 2D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getContainerBox3D(allowCoordBorrow) → {Hash}

Calculate the 3D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

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

getHydrogenCount(includingBondedHydrogen)

If explicitHydrogenCount is set, returns it, else returns implicit hydrogen count.
Parameters:
Name Type Description
includingBondedHydrogen Bool
Source:

getImplicitHydrogenCount() → {Int}

If Kekule.Atom#explicitHydrogenCount is not set, use this function to retrieve count implicit hydrogens.
Source:
Returns:
Implicit hydrogen count.
Type
Int

getImplicitValence()

Guess and returns the implicit valence of atom.
Source:

getLinkedBonds(bondType) → {Array}

Returns linked instances of Kekule.Bond to this node.
Parameters:
Name Type Description
bondType Int
Inherited From:
Source:
Returns:
Type
Array

getLinkedChemNodes(ignoreHydrogenAtoms) → {Array}

Returns neighbor nodes linked to this node through proper connectors.
Parameters:
Name Type Description
ignoreHydrogenAtoms Bool Whether explicit hydrogen atoms are returned. Default is false.
Inherited From:
Source:
Returns:
Type
Array

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

getLinkedDoubleBonds() → {Array}

Returns linked double covalent bond to this node.
Inherited From:
Source:
Returns:
Type
Array

getLinkedHydrogenAtoms() → {Array}

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

getLinkedMultipleBonds() → {Array}

Returns linked multiple covalent bond to this node.
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

getProximalAtomType() → {Hash}

Returns explicit atom type when property Kekule.Atom@atomType is set, or a guessed atom type.
Source:
Returns:
Atom type JSON object from kekule.structGenAtomTypesData.js
Type
Hash

getRootFragment() → {Kekule.StructureFragment}

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

guessAtomType()

If the atomType property is not set explicitly, use this function to guess the atom type. returns {Object} Atom type JSON object from kekule.structGenAtomTypesData.js
Source:

indexOfLinkedConnector(connector) → {Int}

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

isElement(symbolOrAtomicNumber)

Check if current atom is a certain element.
Parameters:
Name Type Description
symbolOrAtomicNumber Variant Symbol(String) or atomic number(Int) of element.
Source:

isNormalAtom()

Check if this is a normal atom (not a pseudo one or unset one)
Source:

isSaturated() → {Bool}

Returns whether this atom is a saturated one.
Inherited From:
Source:
Returns:
Type
Bool

mayContainElement(atomicNumberOrSymbol) → {Bool}

Returns when this node is an atom of certain element or maybe or may include element (peusdo atom or atom list).
Parameters:
Name Type Description
atomicNumberOrSymbol Variant
Inherited From:
Source:
Returns:
Type
Bool

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:

removeThisFromLinkedConnector()

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

setHydrogenCount(value)

Same as setExplicitHydrogenCount.
Parameters:
Name Type Description
value Int
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: