-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathvolumetric.html
94 lines (81 loc) · 3.24 KB
/
volumetric.html
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
<html>
<head>
<title>DX Example</title>
<script src="../build/3Dmol.js"></script>
<style>
head, body {
margin: 0;
border: 0;
padding: 0;
max-height: 100vh
}
</style>
<script>
$(document).ready(function() {
var viewer = $3Dmol.createViewer("viewer");
// TODO
// having multiple volumetric renderers in this file (even on the same volumedata)
// testing (my testing)
// framebuffer antialiasing ?
$.get('../tests/test_structs/benzene-homo.cube', function(data){ // --iso 0.000001 or 0.1 / -0.2->0.2
var voldata = new $3Dmol.VolumeData(data, "cube");
// values outside data range causes error
viewer.addVolumetricRenderer(voldata, {
transferfn:[
{ Color: "#0000ff", pos: -0.2 }, //-0.03
{ Color: "#0000ff", pos: -0.005 },
{ Color: "#ff0000", pos: 0.005 },
{ Color: "#ff0000", pos: 0.2 }, // 1
],
opacityfn:[
{ opacity: 1.0, pos: -0.2 }, //-0.03
{ opacity: 0, pos: -0.005 },
{ opacity: 0, pos: 0.005 },
{ opacity: 1.0, pos: 0.2 }, //1
],
// coords: [{x: 0, y: 0, z: 0}],
// seldist: 1.7
});
var rec1 = viewer.addModel($('#benzene').val(), "sdf");
rec1.setStyle({stick:{color:'lightgray', opacity:'1.0'}, sphere:{color:'gray', radius: 0.4}});
// viewer.addLabel("Aromatic", {position: {x:2.6, y:0.75, z:0.35}, backgroundColor: 0x800080, backgroundOpacity: 0.8});
viewer.zoomTo();
viewer.render();
});
});
</script>
</head>
<body>
<div id="viewer" style="width: 100%; height: 100vh; margin: 0; padding: 0; border: 0;"></div>
<textarea id="benzene" style="visibility:false">
OpenBabel05131411233D
12 12 0 0 0 0 0 0 0 0999 V2000
0.3122 1.3530 -0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.3278 0.4060 -0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.0156 -0.9469 -0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3123 -1.3529 -0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.3278 -0.4061 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0155 0.9469 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.5536 2.3986 -0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
2.3541 0.7199 0.0001 H 0 0 0 0 0 0 0 0 0 0 0 0
1.8004 -1.6788 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-0.5536 -2.3986 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-2.3541 -0.7198 -0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
-1.8005 1.6787 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
1 7 1 0 0 0 0
1 6 2 0 0 0 0
2 3 2 0 0 0 0
2 1 1 0 0 0 0
2 8 1 0 0 0 0
3 4 1 0 0 0 0
3 9 1 0 0 0 0
4 5 2 0 0 0 0
4 10 1 0 0 0 0
5 6 1 0 0 0 0
6 12 1 0 0 0 0
11 5 1 0 0 0 0
M END
$$$$
</textarea>
</body>
</html>