User:Eric Martz/How JSmol works: Difference between revisions
Eric Martz (talk | contribs) |
Eric Martz (talk | contribs) |
||
Line 7: | Line 7: | ||
In order to invoke JSmol, the files on the website server must also include the javascript code for JSmol (filenames ending .js). If the Jmol Java applet is to be invoked, the Java archive files for Jmol (filenames ending .jar) must also be included. All these are included in the download package from [http://jmol.sourceforge.net/download/ jmol.sourceforge.net/download]. | In order to invoke JSmol, the files on the website server must also include the javascript code for JSmol (filenames ending .js). If the Jmol Java applet is to be invoked, the Java archive files for Jmol (filenames ending .jar) must also be included. All these are included in the download package from [http://jmol.sourceforge.net/download/ jmol.sourceforge.net/download]. | ||
==Invoking JSmol== | |||
The HTML page invokes JSmol, specifying a position on the page and a size. Generally, there is a JavaScript ''Info'' variable (Info = {...}) that specifies whether JSmol or Jmol is to be invoked, the size in pixels, and optionally the initial molecule to be displayed, and the display style (JSmol script commands), and other options. This Info variable is then referenced in the actual invocation of JSMol. | |||
The actual invocation generates the necessary HTML by a JavaScript call to Jmol.getApplet() or Jmol.getAppletHtml(). | |||
Examples can be seen in the files supersimple.htm, simple.htm, simple_old.htm, etc. These and other demonstration files will be found in the jsmol directory in the downloaded package from [http://jmol.sourceforge.net/download/ jmol.sourceforge.net/download]. You can drag these files and drop them into a web browser to see the web pages they generate. | |||
==Displaying Molecules== | |||
JSmol is designed to display data files that contain atoms; that is, atomic resolution molecular models. The data file lists atoms, specifying the position in space of each atom (usually in Cartesian coordinates X, Y, Z), the chemical element of the atom, and for macromolecules, the amino acid or nucleotide residue name to which the atom belongs, its position within the residue (e.g. alpha carbon, beta, gamma, etc.), the polymer chain to which the residue belongs, and its sequence number. | |||
Such molecular structure data files are called [[atomic coordinate files]]. JSmol is able to read more than 50 formats of such files. The most common are XYZ format for small organic compounds (usually <100 atoms), and PDB or mmCIF formats for macromolecules. |