Atom

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.

branchBond String

The branch bond as defined in the SMILES.

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.

chirality String

The chirality of this atom if it is a stereocenter (R or S).

priority Number

The priority of this atom acording to the CIP rules, where 0 is the highest priority.

mainChain Boolean

A boolean indicating whether or not this atom is part of the main chain (used for chirality).

hydrogenDirection String

The direction of the hydrogen, either up or down. Only for stereocenters with and explicit hydrogen.

subtreeDepth Number

The depth of the subtree coming from a stereocenter.

class Number

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) mass

Source:

A map mapping element symbols to the atomic mass.

(static) maxBonds

Source:

A map mapping element symbols to their maximum bonds.

Methods

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, chargeopt)

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.

charge Number <optional>
0

The charge 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

getMaxBonds() → {Number}

Source:

Get the maximum number of bonds for this atom.

Returns:

The maximum number of bonds of this 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 Atom

An atom.

atomB Atom

An atom.

Returns:

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

Type
Boolean

isHeteroAtom() → {Boolean}

Source:

Returns whether this atom is a heteroatom (not C and not H).

Returns:

A boolean indicating whether this atom is a heteroatom.

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.