-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
797 lines (723 loc) · 33.9 KB
/
index.html
File metadata and controls
797 lines (723 loc) · 33.9 KB
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MolGarden</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://chemapps.stolaf.edu/jmol/jsmol/JSmol.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0c0e12;
--panel: #14171e;
--panel-hover: #1a1e28;
--border: #252a36;
--text: #e2e4ea;
--text-dim: #8890a0;
--accent: #5bcea6;
--accent-glow: rgba(91, 206, 166, 0.15);
--accent-hover: #7ddcbb;
--danger: #e85d6f;
--warning: #e8b84d;
--radius: 8px;
--radius-sm: 5px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'DM Sans', sans-serif;
background: var(--bg);
color: var(--text);
overflow: hidden;
}
.container {
display: flex;
height: 100vh;
width: 100vw;
}
#appdiv {
width: 100%;
height: 100%;
background: #000;
display: flex;
align-items: center;
justify-content: center;
}
#appdiv *:focus, #appdiv canvas, #appdiv div {
outline: none;
}
/* Branding overlay */
.brand-overlay {
position: absolute;
top: 20px;
left: 24px;
z-index: 10000;
pointer-events: none;
}
.brand-overlay h1 {
font-size: 18px;
font-weight: 700;
letter-spacing: -0.3px;
color: var(--text);
opacity: 0.7;
}
.brand-overlay h1 span {
color: var(--accent);
font-weight: 600;
}
.brand-overlay p {
font-size: 11px;
color: var(--text-dim);
opacity: 0.6;
margin-top: 2px;
font-family: 'JetBrains Mono', monospace;
}
/* Controls panel */
.controls {
width: 360px;
min-width: 320px;
max-width: 420px;
background: var(--panel);
border-left: 1px solid var(--border);
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
}
.controls::-webkit-scrollbar { width: 5px; }
.controls::-webkit-scrollbar-track { background: transparent; }
.controls::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.controls-header {
padding: 20px 20px 12px;
border-bottom: 1px solid var(--border);
position: sticky;
top: 0;
background: var(--panel);
z-index: 5;
}
.controls-header h2 {
font-size: 13px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1.5px;
color: var(--text-dim);
}
.controls-body { padding: 8px 16px 24px; }
/* Control group styling */
.control-group {
margin: 8px 0;
padding: 14px;
background: rgba(255,255,255,0.02);
border: 1px solid var(--border);
border-radius: var(--radius);
transition: border-color 0.2s;
}
.control-group:hover {
border-color: rgba(255,255,255,0.08);
}
.control-group.generation-group {
border-color: var(--accent);
background: var(--accent-glow);
}
.control-group.generation-group:hover {
border-color: var(--accent-hover);
}
.control-group h3 {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
color: var(--text-dim);
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 6px;
}
.control-group h3 .dot {
width: 6px; height: 6px;
border-radius: 50%;
background: var(--accent);
display: inline-block;
}
/* Buttons */
button, input[type="button"] {
padding: 6px 12px;
background: rgba(255,255,255,0.06);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
font-family: 'DM Sans', sans-serif;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.15s;
margin: 3px;
}
button:hover, input[type="button"]:hover {
background: rgba(255,255,255,0.1);
border-color: rgba(255,255,255,0.15);
}
.btn-accent {
background: var(--accent) !important;
color: #0c0e12 !important;
border-color: var(--accent) !important;
font-weight: 600 !important;
}
.btn-accent:hover {
background: var(--accent-hover) !important;
border-color: var(--accent-hover) !important;
}
.btn-sm {
padding: 4px 10px;
font-size: 11px;
}
/* Inputs */
input[type="text"], input[type="number"] {
width: 100%;
padding: 8px 10px;
background: rgba(0,0,0,0.3);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
color: var(--text);
font-family: 'JetBrains Mono', monospace;
font-size: 12px;
outline: none;
transition: border-color 0.2s;
}
input[type="text"]:focus, input[type="number"]:focus {
border-color: var(--accent);
}
input[type="text"]::placeholder { color: var(--text-dim); opacity: 0.5; }
/* Radio buttons */
label {
font-size: 12px;
color: var(--text);
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 4px;
}
input[type="radio"] {
accent-color: var(--accent);
}
input[type="checkbox"] {
accent-color: var(--accent);
}
/* File input display */
.file-row {
display: flex;
align-items: center;
gap: 6px;
margin-top: 6px;
}
.file-row input[type="text"] { flex: 1; }
/* Button row */
.btn-row {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-top: 6px;
}
/* Range slider */
input[type="range"] {
width: 100%;
accent-color: var(--accent);
height: 4px;
}
/* Color picker */
input[type="color"] {
width: 32px; height: 32px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: none;
cursor: pointer;
padding: 2px;
}
/* Status indicator */
.status-bar {
display: flex;
align-items: center;
gap: 6px;
font-size: 11px;
font-family: 'JetBrains Mono', monospace;
color: var(--text-dim);
padding: 6px 0;
}
.status-dot {
width: 6px; height: 6px;
border-radius: 50%;
background: var(--accent);
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.status-dot.idle { animation: none; opacity: 0.4; }
.status-dot.generating { background: var(--warning); }
.status-dot.error { background: var(--danger); animation: none; }
/* Divider */
.divider {
height: 1px;
background: var(--border);
margin: 12px 0;
}
/* Temperature controls */
.temp-row {
display: flex;
align-items: center;
gap: 8px;
margin: 4px 0;
}
.temp-row label {
font-size: 11px;
font-family: 'JetBrains Mono', monospace;
color: var(--text-dim);
min-width: 80px;
}
.temp-row input[type="range"] { flex: 1; }
.temp-row .temp-val {
font-size: 11px;
font-family: 'JetBrains Mono', monospace;
color: var(--accent);
min-width: 30px;
text-align: right;
}
/* Generation log */
#gen-log {
max-height: 80px;
overflow-y: auto;
font-size: 10px;
font-family: 'JetBrains Mono', monospace;
color: var(--text-dim);
background: rgba(0,0,0,0.2);
border-radius: var(--radius-sm);
padding: 6px 8px;
margin-top: 8px;
line-height: 1.6;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
}
/* Mobile */
@media (max-width: 768px) {
.container { flex-direction: column; }
.controls {
width: 100vw;
max-width: 100vw;
min-width: unset;
border-left: none;
border-top: 1px solid var(--border);
max-height: 50vh;
}
#appdiv { height: 50vh; }
.brand-overlay { top: 10px; left: 12px; }
}
</style>
</head>
<body>
<script>
var MP_PROXY_SERVER = "https://mp-proxy-1067494591843.us-central1.run.app/";
var defaultZoomLevel = 70;
var myJmol = 'myJmol';
var Info = {
width: $(window).width() - 360,
height: $(window).height(),
use: "HTML5",
j2sPath: "https://chemapps.stolaf.edu/jmol/jsmol/j2s",
serverURL: "https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
script: `set antialiasDisplay; background black;`,
readyFunction: function(applet) {
console.log("JSmol ready!");
}
};
function default_render() {
return `
reset;
zoom ${defaultZoomLevel};
set antialiasDisplay true;
set multipleBondSpacing 0;
spacefill off;
wireframe off;
cartoons off;
select protein;
cartoon only;
color structure;
select not protein;
spacefill 23%;
wireframe 0.15;
color cpk;
set picking ATOM;
select none;
set display selected;
set selecthalo true;
`;
}
$(document).ready(function() {
$("#appdiv").html(Jmol.getAppletHtml(myJmol, Info));
// Load an example: benzene
Jmol.script(myJmol, `
load DATA "benzene.xyz"
12
C -0.71308 1.20378 0.00000
C -0.00904 -0.01566 0.00000
C 1.39904 -0.01566 0.00000
C 2.10308 1.20378 0.00000
C 1.39904 2.42321 -0.00000
C -0.00904 2.42321 -0.00000
H -1.73551 1.20378 -0.00000
H -0.52025 -0.90111 -0.00000
H 1.91025 -0.90111 -0.00000
H 3.12551 1.20378 -0.00000
H 1.91025 3.30866 0.00000
H -0.52025 3.30866 0.00000
END "benzene.xyz";
${default_render()};
background black;
`);
});
</script>
<div class="container">
<div style="position: relative; flex: 1; min-width: 0;">
<div class="brand-overlay">
<h1>Mol<span>Garden</span></h1>
<p>an interactive 3D molecule builder</p>
</div>
<div id="appdiv">
Loading...
</div>
</div>
<div class="controls">
<div class="controls-header">
<h2>Controls</h2>
</div>
<div class="controls-body">
<!-- ═══════════════ GENERATION ═══════════════ -->
<div class="control-group generation-group">
<h3><span class="dot"></span> Generation</h3>
<label for="model-api-url" style="font-size: 11px; color: var(--text-dim); margin-bottom: 4px; display: block;">Model API Endpoint</label>
<input type="text" id="model-api-url" placeholder="http://127.0.0.1:5000/generate" value="http://127.0.0.1:5000/generate">
<div style="margin-top: 10px;">
<label style="font-size: 11px; display: flex; align-items: center; gap: 5px;">
<input type="checkbox" id="use-conditioning" style="width: auto;">
<span>Conditioning prompt</span>
</label>
<input type="text" id="model-prompt" placeholder="Optional conditioning text (e.g. SMILES, formula)" style="display: none; margin-top: 6px;">
</div>
<div style="margin-top: 10px;">
<label style="font-size: 11px; display: flex; align-items: center; gap: 5px;">
<input type="checkbox" id="auto-generate" style="width: auto;">
<span>Auto-generate (loop until STOP)</span>
</label>
</div>
<div class="divider"></div>
<div class="temp-row">
<label>focus τ</label>
<input type="range" id="temp-focus" min="0.1" max="5" step="0.1" value="2.0" oninput="document.getElementById('temp-focus-val').textContent=this.value">
<span class="temp-val" id="temp-focus-val">2.0</span>
</div>
<div class="temp-row">
<label>radial τ</label>
<input type="range" id="temp-radial" min="0.1" max="5" step="0.1" value="2.0" oninput="document.getElementById('temp-radial-val').textContent=this.value">
<span class="temp-val" id="temp-radial-val">2.0</span>
</div>
<div class="temp-row">
<label>angular τ</label>
<input type="range" id="temp-angular" min="1" max="50" step="1" value="20" oninput="document.getElementById('temp-angular-val').textContent=this.value">
<span class="temp-val" id="temp-angular-val">20</span>
</div>
<div class="btn-row" style="margin-top: 10px;">
<button class="btn-accent" onclick="generateFromModel()" id="gen-btn">▶ Generate Step</button>
<button onclick="clearMolecule()" style="color: var(--danger); border-color: var(--danger);">✕ Clear</button>
</div>
<div class="status-bar">
<span class="status-dot idle" id="status-dot"></span>
<span id="status-text">Ready</span>
</div>
<div id="gen-log"></div>
<script type="text/javascript">
let isGenerating = false;
let genStep = 0;
document.getElementById('use-conditioning').addEventListener('change', function() {
document.getElementById('model-prompt').style.display = this.checked ? 'block' : 'none';
});
function logGen(msg) {
const log = document.getElementById('gen-log');
const time = new Date().toLocaleTimeString('en-US', {hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit'});
log.innerHTML += `<div>[${time}] ${msg}</div>`;
log.scrollTop = log.scrollHeight;
}
function setStatus(state, text) {
const dot = document.getElementById('status-dot');
const txt = document.getElementById('status-text');
dot.className = 'status-dot ' + state;
txt.textContent = text;
}
function clearMolecule() {
Jmol.script(myJmol, 'zap; background black;');
genStep = 0;
setStatus('idle', 'Cleared');
logGen('Molecule cleared');
}
async function generateFromModel() {
if (isGenerating) return;
const apiUrl = document.getElementById('model-api-url').value.trim();
const useConditioning = document.getElementById('use-conditioning').checked;
const prompt = useConditioning ? document.getElementById('model-prompt').value.trim() : '';
const autoGenerate = document.getElementById('auto-generate').checked;
if (!apiUrl) {
alert('Please enter your local API URL');
return;
}
isGenerating = true;
document.getElementById('gen-btn').textContent = '⏳ Generating...';
const doStep = async () => {
genStep++;
setStatus('generating', `Step ${genStep}...`);
logGen(`Step ${genStep}: requesting prediction`);
// Get current geometry from JSmol
Jmol.script(myJmol, 'var temp = {selected}; select *; var currentXYZ = write("xyz"); select @temp;');
const currentXYZ = Jmol.evaluate(myJmol, 'currentXYZ');
try {
const requestBody = {};
if (useConditioning && prompt) {
requestBody.prompt = prompt;
}
// Include temperature parameters
requestBody.inverse_temperature_focus = parseFloat(document.getElementById('temp-focus').value);
requestBody.inverse_temperature_radial = parseFloat(document.getElementById('temp-radial').value);
requestBody.inverse_temperature_angular = parseFloat(document.getElementById('temp-angular').value);
if (currentXYZ) {
requestBody.geometry = currentXYZ;
}
const response = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(requestBody)
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
const xyzData = data.xyz || data.coordinates || data.atoms || data.result;
if (xyzData) {
// Check if model signaled STOP
if (data.stopped) {
logGen(`Step ${genStep}: model returned STOP signal`);
setStatus('idle', `Done — ${genStep} steps`);
// Jmol.script(myJmol, 'spin on');
isGenerating = false;
document.getElementById('gen-btn').textContent = '▶ Generate Step';
return false;
}
const lines = xyzData.trim().split('\n');
const numAtoms = parseInt(lines[0]);
// Capture current orientation before load.
let orient = Jmol.evaluate(myJmol, 'script("show orientation")');
Jmol.script(myJmol, `load DATA "generated.xyz"\n${xyzData}\nEND "generated.xyz"; spacefill 23%; wireframe 0.15; color cpk; set multipleBondSpacing 0; set picking ATOM; select none; set display selected; set selecthalo true; background black;`);
// Restore orientation instantly.
if (orient) {
// Extract just the moveto line, set time to 0.
const moveto = orient.split('\n')[0];
Jmol.script(myJmol, moveto.replace('moveto /* time, axisAngle */ 1.0', 'moveto /* time, axisAngle */ 0'));
}
logGen(`Step ${genStep}: loaded ${numAtoms} atoms`);
setStatus('', `Step ${genStep} — ${numAtoms} atoms`);
return true; // can continue
} else {
throw new Error('No XYZ data in response');
}
} catch (error) {
console.error('Error:', error);
setStatus('error', `Error: ${error.message}`);
logGen(`Error: ${error.message}`);
return false;
}
};
if (autoGenerate) {
let continueGenerating = true;
while (continueGenerating) {
continueGenerating = await doStep();
if (continueGenerating) {
await new Promise(r => setTimeout(r, 300)); // small delay
}
}
// Jmol.script(myJmol, 'spin on');
} else {
await doStep();
}
isGenerating = false;
document.getElementById('gen-btn').textContent = '▶ Generate Step';
}
</script>
</div>
<!-- ═══════════════ UPLOAD ═══════════════ -->
<div class="control-group">
<h3>Upload File</h3>
<input type="file" id="file-input" accept=".xyz,.pdb,.mol,.sdf,.cif" style="display: none;" onchange="handleFileUpload(event)">
<div class="file-row">
<input type="text" id="file-name-display" placeholder=".xyz, .pdb, .mol, .sdf, .cif" readonly>
<script type="text/javascript">
function handleFileUpload(event) {
const file = event.target.files[0];
if (!file) return;
document.getElementById('file-name-display').value = file.name;
const reader = new FileReader();
reader.onload = function(e) {
const fileContent = e.target.result;
const fileName = file.name;
Jmol.script(myJmol, `load DATA "${fileName}"\n${fileContent}\nEND "${fileName}"; ${default_render()}; background black;`);
};
reader.readAsText(file);
}
function openFileDialog() {
document.getElementById('file-input').click();
}
Jmol.jmolButton(myJmol, "javascript openFileDialog()", "Browse");
</script>
</div>
</div>
<!-- ═══════════════ LOAD STRUCTURE ═══════════════ -->
<div class="control-group">
<h3>Load Structure</h3>
<div style="margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 8px;">
<label><input type="radio" name="load-source" value="pdb" checked onchange="updatePlaceholder()"> PDB</label>
<label><input type="radio" name="load-source" value="mp" onchange="updatePlaceholder()"> Materials Project</label>
<label><input type="radio" name="load-source" value="pubchem" onchange="updatePlaceholder()"> PubChem</label>
</div>
<div class="file-row">
<input type="text" id="structure-id" placeholder="Enter PDB code (e.g., 1crn)">
<script type="text/javascript">
function updatePlaceholder() {
var source = document.querySelector('input[name="load-source"]:checked').value;
var input = document.getElementById('structure-id');
if (source === 'pdb') input.placeholder = "e.g. 1crn";
else if (source === 'mp') input.placeholder = "e.g. mp-149";
else if (source === 'pubchem') input.placeholder = "e.g. aspirin";
}
async function loadStructure() {
var structureId = document.getElementById('structure-id').value.trim();
if (!structureId) return;
var source = document.querySelector('input[name="load-source"]:checked').value;
if (source === 'pdb') {
Jmol.script(myJmol, `load =${structureId}; ${default_render()}; background black;`);
} else if (source === 'mp') {
try {
const response = await fetch(`${MP_PROXY_SERVER}/mp/${structureId}`);
const cifContent = await response.text();
if (cifContent && !cifContent.includes('error')) {
Jmol.script(myJmol, `load DATA "${structureId}.cif"\n${cifContent}\nEND "${structureId}.cif"; ${default_render()}; background black;`);
} else {
alert("Structure not found: " + structureId);
}
} catch (error) {
alert("Error loading structure.");
}
} else if (source === 'pubchem') {
Jmol.script(myJmol, `load :${structureId}; ${default_render()}; background black;`);
}
}
Jmol.jmolButton(myJmol, "javascript loadStructure()", "Load");
</script>
</div>
</div>
<!-- ═══════════════ SELECTION ═══════════════ -->
<div class="control-group">
<h3>Selection & Editing</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, "select none", "Clear");
Jmol.jmolButton(myJmol, "select within(2.0, selected)", "Select within 2Å");
Jmol.jmolButton(myJmol, "save state _beforeDelete; delete selected", "Delete");
Jmol.jmolButton(myJmol, "restore state _beforeDelete; set picking ATOM;", "Undo");
</script>
</div>
</div>
<!-- ═══════════════ LABELS ═══════════════ -->
<div class="control-group">
<h3>Atom Labels</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; label %a; select @temp", "Show");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; label off; select @temp", "Hide");
</script>
</div>
</div>
<!-- ═══════════════ DISPLAY ═══════════════ -->
<div class="control-group">
<h3>Display Type</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; spacefill 23%; wireframe 0.15; select @temp", "Ball & Stick");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; wireframe -0.1; select @temp", "Wire");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; spacefill only; select @temp", "Spacefill");
</script>
</div>
</div>
<div class="control-group">
<h3>Isosurface</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; isosurface vdw; select @temp", "Show");
Jmol.jmolButton(myJmol, "isosurface off", "Hide");
</script>
</div>
</div>
<div class="control-group">
<h3>Color Scheme</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, "color cpk", "CPK");
Jmol.jmolButton(myJmol, "color rasmol", "RasMol");
Jmol.jmolButton(myJmol, "color chain", "Chain");
Jmol.jmolButton(myJmol, "color structure", "Structure");
Jmol.jmolButton(myJmol, "color group", "Group");
</script>
</div>
</div>
<div class="control-group">
<h3>Display Mode</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, "cartoon only", "Ribbon");
Jmol.jmolButton(myJmol, "cartoon off; wireframe 0.15; spacefill 23%", "Atoms");
Jmol.jmolButton(myJmol, "cartoon on; wireframe 0.15; spacefill 23%", "Both");
</script>
</div>
</div>
<!-- ═══════════════ VIEW ═══════════════ -->
<div class="control-group">
<h3>View</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, `reset; zoom ${defaultZoomLevel}; background black;`, "Reset");
Jmol.jmolButton(myJmol, "spin on", "Spin ↻");
Jmol.jmolButton(myJmol, "spin off", "Stop");
Jmol.jmolButton(myJmol, "zoom *1.5", "Zoom +");
Jmol.jmolButton(myJmol, "zoom /1.5", "Zoom −");
</script>
</div>
<div style="display: flex; align-items: center; gap: 8px; margin-top: 8px;">
<label style="font-size: 11px; color: var(--text-dim);">Background</label>
<input type="color" id="bg-color-picker" value="#000000" onchange="var hex = this.value; var r = parseInt(hex.substr(1,2), 16); var g = parseInt(hex.substr(3,2), 16); var b = parseInt(hex.substr(5,2), 16); Jmol.script(myJmol, 'background [' + r + ',' + g + ',' + b + ']')">
<label style="font-size: 11px; color: var(--text-dim); margin-left: 8px;">Quality</label>
<script type="text/javascript">
Jmol.jmolButton(myJmol, "set antialiasDisplay true", "Hi");
Jmol.jmolButton(myJmol, "set antialiasDisplay false", "Lo");
</script>
</div>
</div>
<!-- ═══════════════ SAVE ═══════════════ -->
<div class="control-group">
<h3>Export</h3>
<div class="btn-row">
<script type="text/javascript">
Jmol.jmolButton(myJmol, "write image PNG 'molecule.png'", ".png");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; write xyz 'molecule.xyz'; select @temp", ".xyz");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; write pdb 'molecule.pdb'; select @temp", ".pdb");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; write mol 'molecule.mol'; select @temp", ".mol");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; write sdf 'molecule.sdf'; select @temp", ".sdf");
Jmol.jmolButton(myJmol, "var temp = {selected}; select *; write cif 'molecule.cif'; select @temp", ".cif");
</script>
</div>
</div>
</div>
</div>
</div>
</body>
</html>