API Docs for:
Show:

Molecule Class

The Class for Molecules

Constructor

Methods

addAtom

(
  • atom
)
Boolean

Adds the given atom to this molecule

Parameters:

  • atom Atom

    The Atom to be added to this molecule

Returns:

Boolean:

Returns true on success

addBond

(
  • atom
)
Boolean

Adds the given bond to this molecule

Parameters:

  • atom Bond

    The Bond to be added to this molecule

Returns:

Boolean:

Returns true on success

addHydrogens

(
  • [polarOnly=false]
)
Boolean

Add Hydrogens to the entire molecule to fill out implicit valence spots

Parameters:

  • [polarOnly=false] Boolean optional

    Whether to add only polar hydrogens

Returns:

Boolean:

Returns true on success

createAtom

() Atom

Creates a new atom and appends it to this molecule

Returns:

Atom:

Returns the created Atom

createBond

() Bond

Creates a new bond and appends it to this molecule

Returns:

Bond:

Returns the created bond

deleteAtom

(
  • atom
)
Boolean

Deletes the given atom from this molecule

Parameters:

  • atom Atom

    The Atom to be deleted from this molecule

Returns:

Boolean:

Returns true on success

deleteBond

(
  • bond
)
Boolean

Deletes the given bond from this molecule

Parameters:

  • bond Bond

    The Bond to be deleted from this molecule

Returns:

Boolean:

Returns true on success

deleteHydrogens

(
  • [polarOnly=false]
)
Boolean

Delete Hydrogens from the molecule

Parameters:

  • [polarOnly=false] Boolean optional

    Whether to add only polar hydrogens

Returns:

Boolean:

Returns true on success

forEachAtom

(
  • callback
)
Molecule

Executes a callback for each atom

Parameters:

  • callback Function

    The callback to call for each atom

Returns:

Molecule:

Returns this

Example:

mol.forEachAtom(function(atom) {
    console.log(atom.atomicNumber);
});

forEachBond

(
  • callback
)
Molecule

Executes a callback for each bond

Parameters:

  • callback Function

    The callback to call for each bond

Returns:

Molecule:

Returns this

Example:

mol.forEachBond(function(bond) {
    console.log(bond.getOrder());
});

getAngle

(
  • atom1
  • atom2
  • atom3
)
Number

Get angle between 3 atoms of this molecule

Parameters:

Returns:

Number:

Returns the angle

getTorsion

(
  • atom1
  • atom2
  • atom3
  • atom4
)
Number

Get Torsion angle between 4 atoms of this molecule

Parameters:

Returns:

Number:

Returns the torsion angle

has2D

() Boolean

Checks if the molecule has 2D Coordinates

Returns:

Boolean:

Returns the result

has3D

() Boolean

Checks if the molecule has 3D Coordinates

Returns:

Boolean:

Returns the result

hasAromaticCorrected

() Boolean deprecated

Checks if aromatic Nitrogens have been corrected

Returns:

Boolean:

Returns the result

hasAromaticPerceived

() Boolean

Checks if aromatic perception has been performed

Returns:

Boolean:

Returns the result

hasAtomTypesPerceived

() Boolean

Checks if atom types have been assigned

Returns:

Boolean:

Returns the result

hasChainsPerceived

() Boolean

Checks if Biomolecule chains and residues have been assigned.

Returns:

Boolean:

Returns the result

hasChiralityPerceived

() Boolean

Checks if atom chirality have been assigned

Returns:

Boolean:

Returns the result

hasClosureBondsPerceived

() Boolean

Checks if ring "closure" bonds has been assigned

Returns:

Boolean:

Returns the result

hasHybridizationPerceived

() Boolean

Checks if atomic hybridization has been assigned

Returns:

Boolean:

Returns the result

hasHydrogensAdded

() Boolean

Checks if Hydrogens have been added to the molecule

Returns:

Boolean:

Returns the result

hasImplicitValencePerceived

() Boolean

Checks if implicit hydrogen valence has been assigned

Returns:

Boolean:

Returns the result

hasKekulePerceived

() Boolean

Checks if aromaticity and Kekule forms has been assigned

Returns:

Boolean:

Returns the result

hasLSSRPerceived

() Boolean

Checks if the largest set of smallest rings (FindLSSR) has been performed

Returns:

Boolean:

Returns the result

hasNonZeroCoords

() Boolean

Checks if the there are any non-zero coordinates

Returns:

Boolean:

Returns the result

hasPartialChargesPerceived

() Boolean

Checks if atomic Gasteiger partial charges have been assigned

Returns:

Boolean:

Returns the result

hasRingAtomsAndBondsPerceived

() Boolean

Checks if ring atoms and bonds has been assigned

Returns:

Boolean:

Returns the result

hasRingTypesPerceived

() Boolean

Checks if ring types have been assigned

Returns:

Boolean:

Returns the result

hasSSSRPerceived

() Boolean

Checks if the smallest set of smallest rings (FindSSSR) has been performed

Returns:

Boolean:

Returns the result

isChiral

() Boolean

Check if the molecule is chiral

Returns:

Boolean:

Returns the result

isEmpty

() Boolean

Check if the molecule contains no atom

Returns:

Boolean:

Returns the result

setPH

(
  • [pH=7.4]
)
Boolean

Sets the pH. The pH affects on Hydrogens to be added to this molecule

Parameters:

  • [pH=7.4] Number optional

Returns:

Boolean:

Returns true on success

Properties

atoms

Atom[]

Get atoms by given index. It's not iterable. Only can be accessed via given index. Indexes start from 0.

Example:

mol.atoms[1].atomicNumber

atomsCount

Number

Count of atoms in this molecule

bonds

Bond[]

Get bonds by given index. It's not iterable. Only can be accessed via given index. Indexes start from 0.

Example:

mol.bonds[0].order

bondsCount

Number

Count of bonds in this molecule

conformersCount

Number

Count of conformers for this molecule

enery

Number

The value of energy for this molecule

exactMass

Number

The mass given by isotopes

heavyAtomsCount

Number

Count of heavy atoms in this molecule

molarMass

Number

The Standard Molar Mass given bye IUPAC Atomic Masses (amu)

totalCharge

Number

Total chrage of this molecule