-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsv_jme.htm
228 lines (207 loc) · 8.08 KB
/
jsv_jme.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html>
<html>
<head>
<title>JSpecView/JSME/nmrdb/NIH-Resolver Demo II</title>
<meta charset="utf-8" />
<script src="JSmol.min.js"></script>
<!-- for debugging only, replace above JSmol.min.js call with these:
<script src="jquery/jquery.js"></script>
<script src="js/JSmoljQueryExt.js"></script>
<script src="js/JSmolCore.js"></script>
<script src="js/JSmolApplet.js"></script>
<script src="js/JSmolApi.js"></script>
<script src="js/JSmolControls.js"></script>
<script src="js/j2sjmol.js"></script>
<script src="js/JSmol.js"></script>
<script src="js/JSmolConsole.js"></script>
<script src="js/JSmolMenu.js"></script>
-->
<script src="js/JSmolJSV.js"></script>
<script src="js/JSmolJME.js"></script>
<script src="jsme/jsme/jsme.nocache.js"></script>
<script>
function predictSpectrum(isJmol) {
unhideJSV();
if (!isJmol) {
var data = Jmol.jmeGetFile(jme, false);
if (!data.length) {
alert("Please draw a structure or do a search first.");
return;
}
}
Jmol.updateView(isJmol ? jmol : jme);
}
js = Jmol._search;
Jmol._search = function(applet, query) {
unhideJSV();
js(applet, query);
}
Jmol.User.viewUpdatedCallback = function(applet, note) {
$("#moldiv").html(note + "\n\n" + Jmol.View.dumpViews(applet._viewSet))
}
function unhideJSV() {
$("#infodiv").hide();
$("#jsvdiv").show();
}
// The special thing here is Info.viewSet, which defines the group of applets
// that are to be communicating with each other. Info.viewSet is an HTML5-only
// option. You can have any combination of JSME, Jmol, and JSV applets in a group.
var JMEInfo = {
viewSet: 1,
use: "HTML5",
divId: "jmediv", // note: width and height are set by a style attribute in this div
options : "autoez;nocanonize",
editOptions: "editDisabled;",
addSelectionOptions: true,
structureChangedCallback: "testCallback" // Jmol will handle this
}
Jmol.setGrabberOptions([["$", "NCI"]]) // allows 2D reading
/*
var JmolInfo = {
viewSet: 1,
use: "HTML5",
width: 300,
height:250,
addSelectionOptions: false,
disableJ2SLoadMonitor: false,
disableInitialConsole: false
}
*/
JSVInfo = {
viewSet: 1,
use: "HTML5",
width: 800,
height: 500,
color: "0xC0C0C0",
serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
preloadScript: "close views;close simulations > 1; DEFAULTNMRNORMALIZATION 1000;",
script: 'defaultLoadScript "OVERLAYSTACKED true; VIEW *;STACKOFFSETY 50;";',
disableJ2SLoadMonitor: false,
disableInitialConsole: true,
addSelectionOptions: false,
}
//Jmol.setAppletSync(["jsv", "jmol"], ["", ""], true);
$(document).ready(function() {
// $("#infodiv").show();
// $("#jsvdiv").hide();
// $("#jmol_query").val("ethanol");
$("#jme_query").val("ethanol");
// $("#jsv_query").val("ethanol");
$(".btn").css({width:"30px"});
$("a").css({"text-decoration":"none"});
$("#enableEdit").prop('checked', false);
});
function nameIt() {
alert(Jmol.getChemicalInfo(jme, 'names'));
}
</script>
</head>
<body>
<table width=1000 cellpadding=10>
<tr>
<td valign="top">
<table><tr><td>
<table cellspacing=0 cellpadding=0 style="width:100%">
<tr><td>
<label><input id="enableEdit" type="checkbox" onclick="jme._enableEdit(this.checked)">Enable Editing</label></td>
<td title="Draw a simple (known!) structure and click here for a list of names." style="text-align:right"><a href="javascript:nameIt()">Name It!</a>
<a href="javascript:Jmol.saveImage(jme)">Capture Image</a>
</span></td></tr></table>
<div id="jmediv" style="position:relative;width:350px;height:320px;"></div>
<script>
Jmol.getJMEApplet("jme", JMEInfo);
</script>
<br>
<br>
<!--
<textarea id=test cols=40 rows=3>
insert mol file data here
</textarea>
<a href="javascript:jme._applet.readMolFile($('#test').val())">test</a>
<a href="javascript:x = jmol._getMol();jme._applet.readMolFile(x);void($('#test').val(x));">test2</a>
-->
</td><td>
<input class="btn" type="button" onclick="predictSpectrum(0)" value="→" />
</td>
</tr>
<tr><td><span style="font-size:10pt">
Enter an identifier such as a chemical name or SMILES string, or enable editing and draw a compound.
Then click <input class="btn" type="button" onclick="predictSpectrum(0)" value="→" />
to see a <b>simulated</b> spectrum. Or load your own spectrum by dragging a file into the blue box or using
a right-click to access the pop-up menu.
<br>
<br>
To select atoms on the structure, click <span><img src=data/jmestar.png></span> from the menu, then click on an atom.
To select a peak, just click on it. Clickable peaks are the ones with a red tab at the top.
<br>
<br>
This page illustrates how we can use JSME (the JavaScript Molecular Editor)
along with JSpecView to quickly get a simulated spectrum for a compound of our choice.
JSmol on this page calls servers in Frederick, Maryland (NIH resolver, for name-to-structure)
and Lausanne, Switzerland (nmrdb, for structure-to-spectrum).
</span>
<!--
<script>
Jmol.getApplet("jmol", JmolInfo)
</script>
</td><td>
<input class="btn" type="button" onclick="predictSpectrum(1)" value="→" />
-->
</td>
</tr>
</table>
</td>
<td valign="top">
<div id="jsvdiv" style="position:relative;border-style:solid;border-color:blue;border-width:1px">
<script>
Jmol.getJSVApplet("jsv", JSVInfo)
</script>
<br>
<a href="javascript:unhideJSV();Jmol.showInfo(jsv, true);Jmol.showInfo(jmol, true)">info</a>
<a href="javascript:Jmol.clearConsole(jsv);Jmol.clearConsole(jmol);">clear</a>
<a href="javascript:Jmol.showInfo(jsv, false);Jmol.showInfo(jmol, false)">spectrum</a>
<a href="javascript:Jmol.showInfo(jsv, false);Jmol.script(jsv, 'showIntegration')">integration</a>
(drag to zoom; right-click for menu; note that OH and NH may not be shown)
<div style="position:absolute;left:745px;top:510px;z-index:9005"><input type="button" value="print" onclick="Jmol.script(jsv, 'write PDF')"/></div>
</div>
<span style="font-size:10pt">
<a href="http://www.rsc.org/learn-chemistry/collections/spectroscopy">RSC SpectraSchool</a> Assigned Spectra Examples:
<a href="javascript:Jmol.script(jsv, 'load data/nmr_assigned.jdx')">IPA-1HNMR</a>
<a href="javascript:Jmol.script(jsv, 'load data/c13nmr_assigned.jdx')">IPA-13CNMR</a>
<a href="javascript:Jmol.script(jsv, 'load data/tcb-1h.jdx')">TCB-1HNMR</a>
<a href="javascript:Jmol.script(jsv, 'load data/tcb-13c.jdx')">TCB-13CNMR</a>
<a href="javascript:Jmol.script(jsv, 'load data/ir_assigned.jdx')">carvone-IR</a>
<a href="javascript:Jmol.script(jsv, 'load data/mass_assigned.jdx')">carvone-MS</a>
</span>
<div id="infodiv" style="text-align:center;display:none">
This page illustrates how we can use JSME (the JavaScript Molecular Editor)
<br>along with JSpecView to quickly get a simulated spectrum for a compound of our choice.
<br>Note that the three applets can be combined easily in any combination.
<br><br>JSmol on this page calls servers in Frederick, Maryland (NIH resolver, for name-to-structure)
<br>and Lausanne, Switzerland (nmrdb, for structure-to-spectrum)
<br><br><span style="color:blue">Draw a chemical structure
<br>or search for a chemical identifier such as <b>caffeine</b> or <i>CCOCC</i>,
<br>then press <input class="btn" type="button" onclick="predictSpectrum()" value="→" />.</span>
<br><br><span style="color:red">Note that these spectra are <i>just predictions.</i>
<br>They may differ significantly from actual NMR spectra.</span>
</div>
</td>
</tr>
<tr>
<td valign="top">
<span style="white-space:pre">
credits:
<a href=http://jsmol.sourceforge.net/>JSmol and page development</a>: <a href=mailto:hansonr@stolaf.edu>Bob Hanson</a>
<a href=http://peter-ertl.com/jsme/>JSME</a>: Peter Ertl, Bruno Bienfait
<a href=http://jspecview.sourceforge.net>JSpecView</a>: Robert Lancashire, Bob Hanson
<a href=http://www.nmrdb.org>nmrdb</a>: Luc Patiny
<a href=http://cactus.nci.nih.gov>NIH Resolver</a>: Markus Sitzmann
<a href=https://code.google.com/p/java2script>Java2Script</a>: Zhou Renjian
</span>
</td><td>
<div id="moldiv" style="white-space:pre;font-family:monospace"></div>
</td>
</tr>
</table>
</body>
</html>