CH5M3D
Define public routine to store and return elemental information
Parameters:
Z = Atomic number of element
param:
symbol - Elemental symbol
block - "s", "p", "d", or "f" block
valence - # of valence electrons
mass - Atomic mass
radius - Covalent radius of atom
EN - Electronegativity of atom
color - color of atom (based on JMol)
gradient - gradient color for atom
label - color for label
Return value:
Variable containing requested information
Writes html code to a division named "ptable". The periodic table is written as a table, and each element
is linked to to the pickElem() routine.
Define public routine to store and return molecule arrays
Parameter:
value = If value given, then set as active molecule
Return value:
Pointer to current array for molecular coordinates, ex.
var molecule = Mol();
Molecular values stored in 'zeroth' element of array
molecule[0].molIndex - ID number for this molecule
molecule[0].numatoms - # of atoms in this molecule
molecule[0].AtomScale - Scale factor to control size of molecule displayed
molecule[0].showlabels - 0=don't show elemental symbols, 1=show symbols
molecule[0].showcharges - 0=don't show charges, 1=show charges
molecule[0].gradients - 0=don't shade atoms, 1=use shading
molecule[0].formula - Simple text string containing molecular formula
molecule[0].weight - Molecular weight
molecule[0].charge - Charge of molecule
Atomic values in remaining elements of array
molecule[i].atomicnumber - Atomic number (Z) for atom
molecule[i].x - x coordinate of atom
molecule[i].y - y coordinate of atom
molecule[i].z - z coordinate of atom
molecule[i].charge - Estimate of atomic charge
molecule[i].highlite - 0=don't highlight atom, 1=highlight atom
molecule[i].hide - 0=display atom, 1=do not display atom
Define public routine to store and return Bond Matrix
Parameter:
value = If value given, then set as active matrix
Return value:
Pointer to current bond matrix, ex.
var bonds = BondMatrix();
bonds[i][j] then gives indication of bond between atoms "i" and "j"
Given elemental symbol, lookup and return atomic number (Z)
Routine to add atomic information to molecule array.
Parameters are the atomic # and (x,y,z) coordinates of the atom.
Routine to add bonding information to bonds array
(Note that atom numbers start at 1)
Routine to remove selected atom, directly-bonded Hydrogens, and
cleanup molecule object (remove blank slots) and update bond arrays.
atomNum is the position of the atom to delete in the molecule array
Routine to remove bond from bonds array.
Do not display any hydrogen atoms in molecule
Show all atoms in molecule
Find center of molecule and move coordinates to center.
Display molecular coordinates and bonds in information window.
Parameter:
mode=0: Write .xyz formatted file
mode>0: Write coordinates and bond information
Display molecular formula to division with an id = "formula".
Note that the contents of this division will be overwritten.
Routine to start/stop rotation of molecule.
Parameter:
axis = rotation axis. Allowed values are "x", "y", or "z"
("s" can be used to stop all rotations)
Buttons must be created in html with:
id="rotateX" (or rotateY or rotateZ)
Draw atoms and bonds.
Routine to toggle display of atomic labels.
Define constants used to control drawing.
Get/set values using:
var param = parameters();
param.mode = Interface mode. Set to "Draw" or "View"
param.element = Type of element to add next. Default = "C"
param.clouds = # of hybrid orbitals. Default = 4
param.bondmode = Bond mode. Set to "Add", "Delete", or "Rotate"
param.atommode = Add atom mode. Set to "Add" or "Delete"
Routine to enable display of "draw mode" interface.
Routine to enable display of "view mode" interface.
Routine to set the molecular charge using value of select form with id="SelectCharge".
Public routine to (somewhat arbitrarily) assign electron configuration,
including bond orders, and calculate the charges on each atom.
Write Bond information to output window.
Routine to display multiple files stored on the web server.
Parameters:
title: Title to display before gallery
(If title = "delete", clear gallery)
base: Path to directory (relative to web root) containing images
List: Array containing a list of filenames (including extensions)
Desc: Array containing descriptions for each file
size: integer width (in px) for each frame
Routine to force all molecules that are part of a "gallery" to be displayed with the same size scale.
For molecules that are part of a "gallery", this routine optimizes the size of each molecule individually.
Routine to read contents of file stored on the web server.
Parameter:
filename: Name (URL) of file (including path)
Routine to write text to information window (textarea with an id of "information").
Parameters:
mytext: String to write to output window
mode: If >0, then clear text window
Routine to load molecular information for methane molecule.
Routine to reset view. Center, rescale, and remove highlights.
Set color of buttons
Parameters
button - string containing ID name for button
mode - 0=inactive, 1=active
Initialization Routines
- Load properties of elements
- Define Handlers for mouse events
- Draw molecule
Simple routine to perform crude optimization of structure.
Calculate the distance between two atoms in mol array.
Calculate the angle between A--B--C in mol array
Routine to calculate the dihedral angle for A--B--C--D