Atom

SmilesDrawer. Atom

A class representing an atom.

Constructor

new Atom(element, bondTypeopt)

Source:
Properties:
Name Type Description
element String

The element symbol of this atom. Single-letter symbols are always uppercase. Examples: H, C, F, Br, Si, ...

drawExplicit Boolean

A boolean indicating whether or not this atom is drawn explicitly (for example, a carbon atom). This overrides the default behaviour.

ringbonds Array.<Object>

An array containing the ringbond ids and bond types as specified in the original SMILE.

ringbonds[].id Number

The ringbond id as defined in the SMILES.

ringbonds[].bondType String

The bond type of the ringbond as defined in the SMILES.

rings Array.<Number>

The ids of rings which contain this atom.

bondType String

The bond type associated with this array. Examples: -, =, #, ...

isBridge Boolean

A boolean indicating whether or not this atom is part of a bridge in a bridged ring (contained by the largest ring).

isBridgeNode Boolean

A boolean indicating whether or not this atom is a bridge node (a member of the largest ring in a bridged ring which is connected to a bridge-atom).

originalRings Array.<Number>

Used to back up rings when they are replaced by a bridged ring.

bridgedRing Number

The id of the bridged ring if the atom is part of a bridged ring.

anchoredRings Array.<Number>

The ids of the rings that are anchored to this atom. The centers of anchored rings are translated when this atom is translated.

bracket Object

If this atom is defined as a bracket atom in the original SMILES, this object contains all the bracket information. Example: { hcount: {Number}, charge: ['--', '-', '+', '++'], isotope: {Number} }.

plane Number

Specifies on which "plane" the atoms is in stereochemical deptictions (-1 back, 0 middle, 1 front).

attachedPseudoElements Array.<Object>

A map with containing information for pseudo elements or concatinated elements. The key is comprised of the element symbol and the hydrogen count.

attachedPseudoElement[].element String

The element symbol.

attachedPseudoElement[].count Number

The number of occurences that match the key.

attachedPseudoElement[].hyrogenCount Number

The number of hydrogens attached to each atom matching the key.

hasAttachedPseudoElements Boolean

A boolean indicating whether or not this attom will be drawn with an attached pseudo element or concatinated elements.

isDrawn Boolean

A boolean indicating whether or not this atom is drawn. In contrast to drawExplicit, the bond is drawn neither.

isConnectedToRing Boolean

A boolean indicating whether or not this atom is directly connected (but not a member of) a ring.

neighbouringElements Array.<String>

An array containing the element symbols of neighbouring atoms.

isPartOfAromaticRing Boolean

A boolean indicating whether or not this atom is part of an explicitly defined aromatic ring. Example: c1ccccc1.

bondCount Number

The number of bonds in which this atom is participating.

The constructor of the class Atom.

Parameters:
Name Type Attributes Default Description
element String

The one-letter code of the element.

bondType String <optional>
'-'

The type of the bond associated with this atom.

Members

(static) atomicNumbers

Source:

A map mapping element symbols to the atomic number.

(static) maxBonds

Source:

A map mapping element symbols to their maximum bonds.

Methods

(static) getDuplicateAtomicNumbers(sortedAtomicNumbers) → {Array.<Array>}

Source:

Returns sets of duplicate atomic numbers.

Parameters:
Name Type Description
sortedAtomicNumbers Array.<Object>

An array of vertex ids with their associated atomic numbers.

Properties
Name Type Description
vertexId Number

A vertex id.

atomicNumber Number

The atomic number associated with the vertex id.

Returns:

An array of arrays containing the indices of duplicate atomic numbers.

Type
Array.<Array>

(static) hasDuplicateAtomicNumbers(sortedAtomicNumbers) → {Boolean}

Source:

Checks wheter or not two atoms have the same atomic number

Parameters:
Name Type Description
sortedAtomicNumbers Array.<Object>

An array of vertex ids with their associated atomic numbers.

Properties
Name Type Description
vertexId Number

A vertex id.

atomicNumber Number

The atomic number associated with the vertex id.

Returns:

A boolean indicating whether or not there are duplicate atomic numbers.

Type
Boolean

(static) sortByAtomicNumber(root, neighbours, vertices, rings) → {Array.<Object>}

Source:

Sorts an array of vertices by their respecitve atomic number.

Parameters:
Name Type Description
root SmilesDrawer.Vertex

The central vertex

neighbours Array.<Number>

An array of vertex ids.

vertices Array.<SmilesDrawer.Vertex>

An array containing the vertices associated with the current molecule.

rings Array.<SmilesDrawer.Ring>

An array containing the rings associated with the current molecule.

Returns:

The array sorted by atomic number. Example of an array entry: { atomicNumber: 2, vertexId: 5 }.

Type
Array.<Object>

addAnchoredRing(ringId)

Source:

Defines this atom as the anchor for a ring. When doing repositionings of the vertices and the vertex associated with this atom is moved, the center of this ring is moved as well.

Parameters:
Name Type Description
ringId Number

A ring id.

addNeighbouringElement(element)

Source:

Adds a neighbouring element to this atom.

Parameters:
Name Type Description
element String

A string representing an element.

attachPseudoElement(element, previousElement, hydrogenCountopt)

Source:

Attaches a pseudo element (e.g. Ac) to the atom.

Parameters:
Name Type Attributes Default Description
element String

The element identifier (e.g. Br, C, ...).

previousElement String

The element that is part of the main chain (not the terminals that are converted to the pseudo element or concatinated).

hydrogenCount Number <optional>
0

The number of hydrogens for the element.

backupRings()

Source:

Backs up the current rings.

getAtomicNumber() → {Number}

Source:

Get the atomic number of this atom.

Returns:

The atomic number of this atom.

Type
Number

getAttachedPseudoElements() → {Object}

Source:

Returns the attached pseudo elements sorted by hydrogen count (ascending).

Returns:

The sorted attached pseudo elements.

Type
Object

getAttachedPseudoElementsCount() → {Number}

Source:

Returns the number of attached pseudo elements.

Returns:

The number of attached pseudo elements.

Type
Number

getOrder(center) → {Number}

Source:

Returns the order of this atom given a central atom.

Parameters:
Name Type Description
center Number

The id of the central atom in respect to which the order is defined.

Returns:

The order of this atom in respect to the center atom.

Type
Number

getRingbondCount() → {Number}

Source:

Returns the number of ringbonds (breaks in rings to generate the MST of the smiles) within this atom is connected to.

Returns:

The number of ringbonds this atom is connected to.

Type
Number

haveCommonRingbond(atomA, atomB) → {Boolean}

Source:

Checks whether or not two atoms share a common ringbond id. A ringbond is a break in a ring created when generating the spanning tree of a structure.

Parameters:
Name Type Description
atomA SmilesDrawer.Atom

An atom.

atomB SmilesDrawer.Atom

An atom.

Returns:

A boolean indicating whether or not two atoms share a common ringbond.

Type
Boolean

neighbouringElementsEqual(arr) → {Boolean}

Source:

Check whether or not the neighbouring elements of this atom equal the supplied array.

Parameters:
Name Type Description
arr Array.<String>

An array containing all the elements that are neighbouring this atom. E.g. ['C', 'O', 'O', 'N']

Returns:

A boolean indicating whether or not the neighbours match the supplied array of elements.

Type
Boolean

restoreRings()

Source:

Restores the most recent backed up rings.

setOrder(center, order)

Source:

Sets the order of this atom given a center. This is required since two atoms can have an order in respect to two different centers when connected by ringbonds.

Parameters:
Name Type Description
center Number

The id of the central atom in respect to which the order is defined.

order Number

The order of this atom.