| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> |
| 5 |
|
| 6 |
<link rel="stylesheet" type="text/css" href="../ch5m3d.css" /> |
| 7 |
|
| 8 |
<title>CH5M3D</title> |
| 9 |
</head> |
| 10 |
|
| 11 |
<body > |
| 12 |
|
| 13 |
|
| 14 |
<p class="QCHeader"> |
| 15 |
CH<sub>5</sub>M<sub>3D</sub> |
| 16 |
</p> |
| 17 |
<ul id="Toolbar"> |
| 18 |
|
| 19 |
<li><a href="../index.html">CH5M3D Home</a><ul> |
| 20 |
</ul></li> |
| 21 |
|
| 22 |
<li>Documentation<ul> |
| 23 |
<li><a href="introduction.html">Introduction</a></li> |
| 24 |
<li><a href="installation.html">Installation</a></li> |
| 25 |
<li><a href="browser.html">Web Browsers</a></li> |
| 26 |
<li><a href="view.html">User Interface</a></li> |
| 27 |
<li><a href="keyboard.html">Keyboard/Mouse</a></li> |
| 28 |
<li><a href="drawing.html">Drawing</a></li> |
| 29 |
<li><a href="fileformat.html">File Format</a></li> |
| 30 |
<li><a href="../documentation.pdf">PDF Manual</a></li> |
| 31 |
</ul></li> |
| 32 |
<li>Variations<ul> |
| 33 |
<li><a href="description.html">Description</a></li> |
| 34 |
<li><a href="../variations/serverView.html">Pre-Load</a></li> |
| 35 |
<li><a href="../variations/chooser.html">Chooser</a></li> |
| 36 |
<li><a href="../variations/gallery.html">Gallery</a></li> |
| 37 |
<li><a href="../variations/viewer300.html">Viewer (only)</a></li> |
| 38 |
<li><a href="../variations/viewer2x.html">View 2 Windows</a></li> |
| 39 |
<li><a href="../variations/two.html">Two Windows</a></li> |
| 40 |
<li><a href="../variations/api.html">Javascript</a></li> |
| 41 |
<li><a href="../qchem/qchem.php">Quantum Interface</a></li> |
| 42 |
</ul></li> |
| 43 |
<li>Information<ul> |
| 44 |
<li><a href="about.html">About</a></li> |
| 45 |
<li><a href="http://sourceforge.net/projects/ch5m3d/">Project Homepage</a></li> |
| 46 |
<li><a href="apidoc.html">Library API Info</a></li> |
| 47 |
<li><a href="https://www.gnu.org/licenses/gpl.html">GNU License</a></li> |
| 48 |
</ul></li> |
| 49 |
|
| 50 |
</ul> |
| 51 |
|
| 52 |
|
| 53 |
<p> </p><h3>function element(Z,param)</h3> |
| 54 |
<p>Define public routine to store and return elemental information</p> |
| 55 |
<p>Parameters:</p> |
| 56 |
<p> Z = Atomic number of element</p> |
| 57 |
<p> param:</p> |
| 58 |
<p> symbol - Elemental symbol</p> |
| 59 |
<p> block - "s", "p", "d", or "f" block </p> |
| 60 |
<p> valence - # of valence electrons</p> |
| 61 |
<p> mass - Atomic mass</p> |
| 62 |
<p> radius - Covalent radius of atom</p> |
| 63 |
<p> EN - Electronegativity of atom</p> |
| 64 |
<p> color - color of atom (based on JMol)</p> |
| 65 |
<p> gradient - gradient color for atom</p> |
| 66 |
<p> label - color for label</p> |
| 67 |
<p>Return value:</p> |
| 68 |
<p> Variable containing requested information</p> |
| 69 |
<p> </p><h3>function drawPeriodic()</h3> |
| 70 |
<p>Writes html code to a division named "ptable". The periodic table is written as a table, and each element</p> |
| 71 |
<p>is linked to to the pickElem() routine.</p> |
| 72 |
<p> </p><h3>function Mol(value)</h3> |
| 73 |
<p>Define public routine to store and return molecule arrays</p> |
| 74 |
<p>Parameter:</p> |
| 75 |
<p> value = If value given, then set as active molecule</p> |
| 76 |
<p> </p> |
| 77 |
<p>Return value:</p> |
| 78 |
<p> Pointer to current array for molecular coordinates, ex.</p> |
| 79 |
<p> var molecule = Mol();</p> |
| 80 |
<p>Molecular values stored in 'zeroth' element of array</p> |
| 81 |
<p> molecule[0].molIndex - ID number for this molecule</p> |
| 82 |
<p> molecule[0].numatoms - # of atoms in this molecule </p> |
| 83 |
<p> molecule[0].AtomScale - Scale factor to control size of molecule displayed</p> |
| 84 |
<p> molecule[0].showlabels - 0=don't show elemental symbols, 1=show symbols</p> |
| 85 |
<p> molecule[0].showcharges - 0=don't show charges, 1=show charges</p> |
| 86 |
<p> molecule[0].gradients - 0=don't shade atoms, 1=use shading</p> |
| 87 |
<p> molecule[0].formula - Simple text string containing molecular formula</p> |
| 88 |
<p> molecule[0].weight - Molecular weight</p> |
| 89 |
<p> molecule[0].charge - Charge of molecule</p> |
| 90 |
<p>Atomic values in remaining elements of array</p> |
| 91 |
<p> molecule[i].atomicnumber - Atomic number (Z) for atom</p> |
| 92 |
<p> molecule[i].x - x coordinate of atom</p> |
| 93 |
<p> molecule[i].y - y coordinate of atom</p> |
| 94 |
<p> molecule[i].z - z coordinate of atom</p> |
| 95 |
<p> molecule[i].charge - Estimate of atomic charge</p> |
| 96 |
<p> molecule[i].highlite - 0=don't highlight atom, 1=highlight atom</p> |
| 97 |
<p> molecule[i].hide - 0=display atom, 1=do not display atom</p> |
| 98 |
<p> </p><h3>function BondMatrix(value)</h3> |
| 99 |
<p>Define public routine to store and return Bond Matrix</p> |
| 100 |
<p>Parameter:</p> |
| 101 |
<p> value = If value given, then set as active matrix</p> |
| 102 |
<p> </p> |
| 103 |
<p>Return value:</p> |
| 104 |
<p> Pointer to current bond matrix, ex.</p> |
| 105 |
<p> var bonds = BondMatrix();</p> |
| 106 |
<p> bonds[i][j] then gives indication of bond between atoms "i" and "j"</p> |
| 107 |
<p> </p><h3>function lookupSymbol(symbol)</h3> |
| 108 |
<p>Given elemental symbol, lookup and return atomic number (Z)</p> |
| 109 |
<p> </p><h3>function addAtom(AtomicNum, x, y, z)</h3> |
| 110 |
<p>Routine to add atomic information to molecule array.</p> |
| 111 |
<p>Parameters are the atomic # and (x,y,z) coordinates of the atom.</p> |
| 112 |
<p> </p><h3>function addBond(atom1, atom2)</h3> |
| 113 |
<p>Routine to add bonding information to bonds array</p> |
| 114 |
<p>(Note that atom numbers start at 1) </p> |
| 115 |
<p> </p><h3>function delAtom(atomNum)</h3> |
| 116 |
<p>Routine to remove selected atom, directly-bonded Hydrogens, and</p> |
| 117 |
<p>cleanup molecule object (remove blank slots) and update bond arrays.</p> |
| 118 |
<p>atomNum is the position of the atom to delete in the molecule array</p> |
| 119 |
<p> </p><h3>function delBond(atom1, atom2)</h3> |
| 120 |
<p>Routine to remove bond from bonds array.</p> |
| 121 |
<p> </p><h3>function hideH()</h3> |
| 122 |
<p>Do not display any hydrogen atoms in molecule</p> |
| 123 |
<p> </p><h3>function showAll()</h3> |
| 124 |
<p>Show all atoms in molecule</p> |
| 125 |
<p> </p><h3>function centerMolecule()</h3> |
| 126 |
<p>Find center of molecule and move coordinates to center.</p> |
| 127 |
<p> </p><h3>function showCoord(mode)</h3> |
| 128 |
<p>Display molecular coordinates and bonds in information window.</p> |
| 129 |
<p>Parameter:</p> |
| 130 |
<p> mode=0: Write .xyz formatted file</p> |
| 131 |
<p> mode>0: Write coordinates and bond information</p> |
| 132 |
<p> </p><h3>function formula()</h3> |
| 133 |
<p>Display molecular formula to division with an id = "formula".</p> |
| 134 |
<p>Note that the contents of this division will be overwritten.</p> |
| 135 |
<p> </p><h3>function RotateMolecule(axis)</h3> |
| 136 |
<p>Routine to start/stop rotation of molecule.</p> |
| 137 |
<p>Parameter:</p> |
| 138 |
<p> axis = rotation axis. Allowed values are "x", "y", or "z"</p> |
| 139 |
<p> ("s" can be used to stop all rotations)</p> |
| 140 |
<p>Buttons must be created in html with:</p> |
| 141 |
<p> id="rotateX" (or rotateY or rotateZ)</p> |
| 142 |
<p> </p><h3>function drawMolecule()</h3> |
| 143 |
<p>Draw atoms and bonds.</p> |
| 144 |
<p> </p><h3>function showLabels()</h3> |
| 145 |
<p>Routine to toggle display of atomic labels.</p> |
| 146 |
<p> </p><h3>function parameters()</h3> |
| 147 |
<p>Define constants used to control drawing.</p> |
| 148 |
<p>Get/set values using:</p> |
| 149 |
<p> var param = parameters();</p> |
| 150 |
<p> param.mode = Interface mode. Set to "Draw" or "View"</p> |
| 151 |
<p> param.element = Type of element to add next. Default = "C"</p> |
| 152 |
<p> param.clouds = # of hybrid orbitals. Default = 4</p> |
| 153 |
<p> param.bondmode = Bond mode. Set to "Add", "Delete", or "Rotate"</p> |
| 154 |
<p> param.atommode = Add atom mode. Set to "Add" or "Delete"</p> |
| 155 |
<p> </p><h3>function drawmode()</h3> |
| 156 |
<p>Routine to enable display of "draw mode" interface.</p> |
| 157 |
<p> </p><h3>function viewmode()</h3> |
| 158 |
<p>Routine to enable display of "view mode" interface.</p> |
| 159 |
<p> </p><h3>function setCharge()</h3> |
| 160 |
<p>Routine to set the molecular charge using value of select form with id="SelectCharge".</p> |
| 161 |
<p> </p><h3>function simpleQ()</h3> |
| 162 |
<p>Public routine to (somewhat arbitrarily) assign electron configuration,</p> |
| 163 |
<p>including bond orders, and calculate the charges on each atom.</p> |
| 164 |
<p> </p><h3>function showBondMatrix(BondMtx,BondWin)</h3> |
| 165 |
<p>Write Bond information to output window.</p> |
| 166 |
<p> </p><h3>function showgallery(title,base,List,Desc,size)</h3> |
| 167 |
<p>Routine to display multiple files stored on the web server.</p> |
| 168 |
<p>Parameters:</p> |
| 169 |
<p> title: Title to display before gallery</p> |
| 170 |
<p> (If title = "delete", clear gallery)</p> |
| 171 |
<p> base: Path to directory (relative to web root) containing images </p> |
| 172 |
<p> List: Array containing a list of filenames (including extensions)</p> |
| 173 |
<p> Desc: Array containing descriptions for each file</p> |
| 174 |
<p> size: integer width (in px) for each frame</p> |
| 175 |
<p> </p><h3>function galleryUniform()</h3> |
| 176 |
<p>Routine to force all molecules that are part of a "gallery" to be displayed with the same size scale.</p> |
| 177 |
<p> </p><h3>function galleryReset()</h3> |
| 178 |
<p>For molecules that are part of a "gallery", this routine optimizes the size of each molecule individually.</p> |
| 179 |
<p> </p><h3>function readServerFile(filename)</h3> |
| 180 |
<p>Routine to read contents of file stored on the web server.</p> |
| 181 |
<p>Parameter:</p> |
| 182 |
<p> filename: Name (URL) of file (including path)</p> |
| 183 |
<p> </p><h3>function InfoWin(mytext,mode)</h3> |
| 184 |
<p>Routine to write text to information window (textarea with an id of "information").</p> |
| 185 |
<p>Parameters:</p> |
| 186 |
<p> mytext: String to write to output window</p> |
| 187 |
<p> mode: If >0, then clear text window</p> |
| 188 |
<p> </p><h3>function loadMolecule()</h3> |
| 189 |
<p>Routine to load molecular information for methane molecule.</p> |
| 190 |
<p> </p><h3>function resetView()</h3> |
| 191 |
<p>Routine to reset view. Center, rescale, and remove highlights.</p> |
| 192 |
<p> </p><h3>function buttonColor(button, mode)</h3> |
| 193 |
<p>Set color of buttons</p> |
| 194 |
<p>Parameters</p> |
| 195 |
<p> button - string containing ID name for button</p> |
| 196 |
<p> mode - 0=inactive, 1=active</p> |
| 197 |
<p> </p><h3>function initialize()</h3> |
| 198 |
<p>Initialization Routines</p> |
| 199 |
<p> - Load properties of elements</p> |
| 200 |
<p> - Define Handlers for mouse events</p> |
| 201 |
<p> - Draw molecule</p> |
| 202 |
<p> </p><h3>function mechanics()</h3> |
| 203 |
<p>Simple routine to perform crude optimization of structure.</p> |
| 204 |
<p> </p><h3>function distance(mol, atomA, atomB)</h3> |
| 205 |
<p>Calculate the distance between two atoms in mol array.</p> |
| 206 |
<p> </p><h3>function angle(mol, atomA, atomB, atomC)</h3> |
| 207 |
<p>Calculate the angle between A--B--C in mol array</p> |
| 208 |
<p> </p><h3>function dihedral(mol, atomA, atomB, atomC, atomD)</h3> |
| 209 |
<p>Routine to calculate the dihedral angle for A--B--C--D</p> |
| 210 |
|
| 211 |
<div class="Footer" id="Footer"> |
| 212 |
The chem3d.js library copyright © 2013 by Clarke Earley<br /> |
| 213 |
and is distributed under the terms of the |
| 214 |
<a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>. |
| 215 |
</div> |
| 216 |
|
| 217 |
</body> |
| 218 |
</html> |