-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsv_predict2.htm
216 lines (190 loc) · 6.85 KB
/
jsv_predict2.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
<!DOCTYPE html>
<html>
<head>
<title>JSpecView/JSME/nmrdb/NIH-Resolver demo</title>
<meta charset="utf-8" />
<script type="text/javascript" src="JSmol.min.js"></script>
<!--
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="js/JSmoljQueryExt.js"></script>
<script type="text/javascript" src="js/JSmolCore.js"></script>
<script type="text/javascript" src="js/JSmolApplet.js"></script>
<script type="text/javascript" src="js/JSmolApi.js"></script>
<script type="text/javascript" src="js/JSmolControls.js"></script>
<script type="text/javascript" src="js/j2sjmol.js"></script>
<script type="text/javascript" src="js/JSmol.js"></script>
<script type="text/javascript" src="js/JSmolConsole.js"></script>
-->
<script type="text/javascript" src="js/JSmolMenu.js"></script>
<script type="text/javascript" src="js/JSmolJSV.js"></script>
<script type="text/javascript" src="js/JSmolJME.js"></script>
<script type="text/javascript" language="javascript" src="jsme/jsme/jsme.nocache.js"></script>
<!-- Jmol_functions
//var x = load("https://cactus.nci.nih.gov/chemical/structure/tylenol/file?format=mrv")
function getJMEHs() {
select visible
var x= show("chemical mrv")
var x2 = x.split('x2="')[2].split('"')[1].split(" ")
var y2 = x.split('y2="')[2].split('"')[1].split(" ")
var s = "" + {*}.size + " " + {*}.bonds.size
for (var i = 1; i <= x2.length; i++) {
s += " " + {*}[i].element + " " + x2[i] + " " + y2[i]
}
var b = x.split("<bond ")
for (var i = 2; i <= b.length; i++) {
var bi = b[i]
var at = bi.split("atomRefs2=\"")[2].split('"')[1].replace("a","").split(" ")
var n = (bi.find(">W<") ? -1 : bi.find(">H<") ? -2 : bi.split("order=\"")[2].split('"')[1])
s += " " + at[1] + " " + at[2] + " " + n
}
return s
}
-->
<script type="text/javascript">
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",
options : "autoez;nocanonize",
addSelectionOptions: true,
structureChangeCallback: null // 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
// script: "x = load('"
// + document.location.href + "').split('Jmol_functions')[2].split('--')[1];script inline @x"
}
JSVInfo = {
viewSet: 1,
use: "HTML5",
width: 800,
height: 600,
color: "0xC0C0C0",
serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
preloadScript: "close views;close simulations > 1; DEFAULTNMRNORMALIZATION 100;",
script: 'defaultLoadScript "OVERLAYSTACKED true; VIEW *;STACKOFFSETY 50;";',
disableJ2SLoadMonitor: false,
disableInitialConsole: false,
addSelectionOptions: true,
}
//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"});
});
</script>
</head>
<body>
<table width=1000 cellpadding=10>
<tr>
<td valign="top">
<table><tr><td>
<div id="jmediv" style="position:relative;width:300px;height:300px;"></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>
<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">
<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>
(note that OH and NH hydrogens will not be shown)
<div style="position:absolute;left:745px;top:565px;z-index:9005"><input type="button" value="print" onclick="Jmol.script(jsv, 'write PDF')"/></div>
</div>
<div id="infodiv" style="text-align:center">
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>