-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructure-inspector.html
More file actions
927 lines (880 loc) · 82.6 KB
/
Copy pathstructure-inspector.html
File metadata and controls
927 lines (880 loc) · 82.6 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
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
<!DOCTYPE html>
<html lang="en" class="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Structure Inspector | WebGL Molecular Viewer | STEMKit</title>
<meta name="description" content="Free browser-based 3D molecular viewer. Load PDB, GRO, XYZ, CIF, MOL2 or CUBE files, select atoms by chain, residue, element or distance, measure bonds and angles, and export publication-quality images, all rendered locally with WebGL.">
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
<link rel="stylesheet" href="css/all.min.css">
<script src="js/dependencies/3Dmol-min.js"></script>
<script type="application/ld+json">
{"@context": "https://schema.org", "@type": "HowTo", "name": "How to inspect a molecular structure in 3D", "totalTime": "PT2M", "step": [{"@type": "HowToStep", "position": 1, "name": "Load a structure", "text": "Drag in a PDB, GRO, XYZ, CIF, MOL2 or CUBE coordinate file, or enter a four-character PDB ID to fetch it from RCSB."}, {"@type": "HowToStep", "position": 2, "name": "Pick a representation", "text": "Choose cartoon, stick, ball-and-stick, sphere, cross or wireframe, then colour by element, chain, residue, B-factor or secondary structure."}, {"@type": "HowToStep", "position": 3, "name": "Narrow the selection", "text": "Filter by chain, residue and element, add a within-distance radius for binding pockets, or slice along an axis with the spatial sliders, then Isolate or Highlight."}, {"@type": "HowToStep", "position": 4, "name": "Measure and export", "text": "Enable measure mode and click two atoms for a distance or three for an angle, then export a high-resolution PNG or save the selection as a PDB fragment."}]}
</script>
<script type="application/ld+json">
{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "Is my structure uploaded anywhere?", "acceptedAnswer": {"@type": "Answer", "text": "No. Files are read with the browser's FileReader and rendered by 3Dmol.js on your own GPU. The only network request is the optional PDB ID fetch, which asks RCSB for that one public entry."}}, {"@type": "Question", "name": "Which file formats are supported?", "acceptedAnswer": {"@type": "Answer", "text": "PDB, ENT, CIF/mmCIF, SDF, MOL, MOL2, XYZ, GRO, PQR, PRMTOP, MMTF, CDJSON, CUBE and VASP/POSCAR/CONTCAR. Multi-frame files load as a trajectory with a frame slider."}}, {"@type": "Question", "name": "Why does the cartoon style show nothing?", "acceptedAnswer": {"@type": "Answer", "text": "Cartoon rendering needs backbone connectivity and secondary-structure information, which only protein and nucleic-acid formats carry. Use stick or ball-and-stick for small molecules and bare XYZ files."}}, {"@type": "Question", "name": "Why are my labels capped or disabled?", "acceptedAnswer": {"@type": "Answer", "text": "Each label is an individual sprite and costs far more than an atom. Above 5,000 atoms the tool warns and exposes a cap; above 50,000 it disables labels to stop the tab freezing."}}, {"@type": "Question", "name": "My high-resolution export came out smaller than I asked for.", "acceptedAnswer": {"@type": "Answer", "text": "WebGL contexts have a maximum texture size, commonly 4096, 8192 or 16384 pixels. Requests beyond that limit would black out the canvas, so exports are clamped to the largest safe size."}}, {"@type": "Question", "name": "What is the difference between Isolate and Highlight?", "acceptedAnswer": {"@type": "Answer", "text": "Isolate hides everything outside the selection for a clean figure. Highlight keeps the rest of the structure as a faint wireframe so the selection stays in context."}}, {"@type": "Question", "name": "Which surface type should I use?", "acceptedAnswer": {"@type": "Answer", "text": "Van der Waals is fastest and shows atomic radii. Solvent-accessible traces a rolling probe centre and is used for buried-area calculations. Solvent-excluded hugs the molecule tightly and looks best in figures but costs the most."}}, {"@type": "Question", "name": "Can I script the same selections elsewhere?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. The query box compiles to a 3Dmol AtomSelectionSpec object, so chain:A resn:HEM is simply {chain:'A', resn:'HEM'} in the library's API."}}, {"@type": "Question", "name": "Turning on labels used to freeze the tab. What changed?", "acceptedAnswer": {"@type": "Answer", "text": "Labels are built in small slices spread across animation frames instead of one blocking loop, so the browser keeps painting and shows a live progress count. They are scoped to the current selection by default, and when a scope exceeds the limit the atoms nearest the centre of the view are kept."}}, {"@type": "Question", "name": "How do I make a clean measurement figure?", "acceptedAnswer": {"@type": "Answer", "text": "Enable Figure mode in the Tools tab. Everything except the measured atoms drops to a faint wireframe, thin stick, cartoon or hidden at an opacity you control, while the picked atoms keep full representation. Measurement appearance controls line colour, thickness, dash, marker size, label size and colour, decimals and units."}}, {"@type": "Question", "name": "Can I get the measurement numbers out as data?", "acceptedAnswer": {"@type": "Answer", "text": "Copy data puts every measurement on the clipboard as tab-separated text with type, atoms, value and unit columns, which pastes directly into a spreadsheet."}}, {"@type": "Question", "name": "Why does building a surface still pause the viewer?", "acceptedAnswer": {"@type": "Answer", "text": "Surface meshing is a single synchronous call inside 3Dmol.js and cannot be sliced across frames. The tool paints a busy indicator and starts work on the next frame so you get feedback, refuses above 100,000 atoms, and can scope the surface to your current selection."}}]}
</script>
<link rel="stylesheet" href="src/home.css">
<link rel="stylesheet" href="src/output.css">
<link rel="stylesheet" href="src/stemkit-docs.css">
<link rel="stylesheet" href="src/tools/structure-inspector.css">
</head>
<body class="bg-slate-50 dark:bg-slate-950 text-slate-900 dark:text-slate-100 min-h-screen flex flex-col transition-colors duration-300">
<!-- NAV -->
<nav class="sticky top-0 z-50 w-full bg-white/80 dark:bg-slate-950/80 backdrop-blur-md border-b border-slate-200 dark:border-slate-800 transition-colors duration-300">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16 sm:h-20">
<a href="index.html" class="flex items-center gap-2 hover:opacity-80 transition-opacity">
<div class="bg-indigo-600 text-white p-2 sm:p-2.5 rounded-lg shadow-sm flex items-center justify-center"><i class="fa-solid fa-flask text-lg sm:text-xl"></i></div>
<span class="text-xl sm:text-2xl font-black tracking-tighter text-slate-900 dark:text-white">STEMKit</span>
</a>
<div class="hidden md:flex items-center gap-6 text-sm font-semibold text-slate-600 dark:text-slate-300">
<a href="index.html#data-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Data</a>
<a href="index.html#comp-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Compute</a>
<a href="index.html#pub-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Writing & Citations</a>
<a href="index.html#focus-tools" class="hover:text-indigo-600 dark:hover:text-indigo-400 transition-colors">Focus</a>
<div class="h-5 w-px bg-slate-200 dark:bg-slate-700"></div>
<button class="themeToggle p-2 rounded-full hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors" aria-label="Toggle dark mode">
<i class="fa-solid fa-moon dark:hidden text-lg"></i><i class="fa-solid fa-sun hidden dark:block text-yellow-400 text-lg"></i>
</button>
<a href="plot-digitizer.html" class="bg-indigo-600 hover:bg-indigo-700 text-white px-5 py-2.5 rounded-full text-sm font-bold transition-all shadow-md hover:shadow-lg"><i class="fa-solid fa-crosshairs mr-1"></i> Plot Digitizer</a>
</div>
<div class="flex items-center gap-2 md:hidden">
<button class="themeToggle p-2 rounded-full hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors text-slate-600 dark:text-slate-300"><i class="fa-solid fa-moon dark:hidden text-lg"></i><i class="fa-solid fa-sun hidden dark:block text-yellow-400 text-lg"></i></button>
<button id="mobile-menu-btn" class="text-slate-600 dark:text-slate-300 hover:text-indigo-600 p-2 focus:outline-none"><i class="fa-solid fa-bars text-2xl" id="menu-icon"></i></button>
</div>
</div>
</div>
<div id="mobile-menu" class="hidden md:hidden bg-white/95 dark:bg-slate-900/95 backdrop-blur-md border-b border-slate-200 dark:border-slate-800 absolute w-full shadow-xl">
<div class="px-4 pt-2 pb-6 space-y-2 text-base font-semibold text-slate-600 dark:text-slate-300">
<a href="index.html#data-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Data & Stats</a>
<a href="index.html#comp-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Compute</a>
<a href="index.html#pub-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Writing & Citations</a>
<a href="index.html#focus-tools" class="mobile-link block py-3 px-4 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-indigo-600 transition-colors">Focus & Flow</a>
<div class="pt-4 mt-2 border-t border-slate-100 dark:border-slate-800">
<a href="plot-digitizer.html" class="block text-center bg-indigo-600 hover:bg-indigo-700 text-white py-3 rounded-xl shadow-md transition-colors">Plot Digitizer</a>
</div>
</div>
</div>
</nav>
<main class="flex-grow max-w-7xl mx-auto px-4 sm:px-6 py-6 w-full flex flex-col gap-6">
<!-- UPLOAD ZONE -->
<section id="uploadZone" class="stk-drop si-drop" aria-label="Load a structure">
<input type="file" id="fileInput" accept=".pdb,.xyz,.gro,.sdf,.mol,.mol2,.cif,.mcif,.cdjson,.json,.mmtf,.prmtop,.pqr,.cube,.vasp,.poscar,.contcar,.ent" class="hidden" aria-label="Upload molecular structure file">
<span class="stk-drop-icon" aria-hidden="true"><i class="fa-solid fa-microscope"></i></span>
<h1>3D Structure Inspector</h1>
<p>Render a coordinate file in the browser, select atoms by chain, residue, element or distance, measure geometry and export a figure.</p>
<div class="stk-drop-actions">
<button type="button" id="chooseFileBtn" class="stk-btn stk-btn-primary"><i class="fa-solid fa-folder-open"></i>Choose file</button>
<div class="si-fetch">
<input id="pdbIdInput" type="text" maxlength="6" placeholder="PDB ID, e.g. 4N8T" class="stk-input stk-mono" aria-label="PDB identifier" autocomplete="off" spellcheck="false">
<button type="button" id="fetchPdbBtn" class="stk-btn"><i class="fa-solid fa-cloud-arrow-down"></i>Fetch</button>
</div>
</div>
<div class="stk-drop-actions si-samples">
<span class="stk-hint">Or try a sample:</span>
<button type="button" class="stk-btn stk-btn-sm stk-btn-soft si-sample" data-sample="assets/samples/helix-ala15.pdb"><i class="fa-solid fa-dna"></i>Poly-alanine helix</button>
<button type="button" class="stk-btn stk-btn-sm stk-btn-soft si-sample" data-sample="assets/samples/benzene.xyz"><i class="fa-solid fa-ring"></i>Benzene</button>
</div>
<div class="stk-drop-formats" aria-label="Accepted formats">
<span class="stk-badge">PDB</span><span class="stk-badge">ENT</span><span class="stk-badge">CIF</span><span class="stk-badge">mmCIF</span><span class="stk-badge">SDF</span><span class="stk-badge">MOL</span><span class="stk-badge">MOL2</span><span class="stk-badge">XYZ</span><span class="stk-badge">GRO</span><span class="stk-badge">PQR</span><span class="stk-badge">PRMTOP</span><span class="stk-badge">MMTF</span><span class="stk-badge">CDJSON</span><span class="stk-badge">CUBE</span><span class="stk-badge">VASP</span>
</div>
<p class="stk-hint">Files are parsed in your browser and never uploaded.</p>
</section>
<!-- WORKSPACE -->
<section id="workspace" class="stk-shell si-workspace hidden flex-col lg:flex-row w-full" aria-label="Structure viewer">
<!-- SIDEBAR -->
<aside id="sidebar" class="si-sidebar stk-shell-pane stk-scroll">
<div class="si-head">
<div class="si-head-main">
<h2 id="fileName" class="si-file">structure.pdb</h2>
<p id="structureMeta" class="si-meta stk-tnum">0 Atoms</p>
<span id="formatBadge" class="stk-badge stk-badge-accent"></span>
</div>
<div class="si-head-actions">
<button type="button" id="collapseSidebarBtn" class="stk-btn stk-btn-ghost stk-btn-icon stk-btn-sm si-desktop-only" aria-label="Hide panel" title="Hide panel"><i class="fa-solid fa-chevron-left"></i></button>
<button type="button" id="resetBtn" class="stk-btn stk-btn-ghost stk-btn-icon stk-btn-sm" aria-label="Close viewer" title="Close viewer"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="si-head-extra">
<div id="perfWarning" class="stk-callout stk-callout-warn hidden" role="status">
<i class="fa-solid fa-triangle-exclamation"></i>
<span id="perfWarningText"></span>
</div>
<!-- Trajectory (shown for multi-frame files) -->
<div id="trajectoryPanel" class="stk-group hidden">
<h3 class="stk-group-t">Trajectory</h3>
<div class="si-transport">
<button type="button" id="trajPrev" class="stk-btn stk-btn-sm stk-btn-icon" aria-label="Previous frame" title="Previous frame"><i class="fa-solid fa-backward-step"></i></button>
<button type="button" id="trajPlay" class="stk-btn stk-btn-sm si-grow"><i class="fa-solid fa-play"></i>Play</button>
<button type="button" id="trajNext" class="stk-btn stk-btn-sm stk-btn-icon" aria-label="Next frame" title="Next frame"><i class="fa-solid fa-forward-step"></i></button>
</div>
<div class="si-range-row">
<label class="si-range-label" for="trajSlider">Frame</label>
<input type="range" id="trajSlider" min="0" max="0" step="1" value="0" class="stk-range">
<span id="trajFrame" class="si-range-val">0/0</span>
</div>
<div class="stk-field">
<label for="trajSpeed">Playback speed</label>
<select id="trajSpeed" class="stk-select stk-select-sm">
<option value="200">Slow</option>
<option value="100" selected>Normal</option>
<option value="50">Fast</option>
<option value="20">Very fast</option>
</select>
</div>
</div>
<!-- Isosurface (shown for cube files) -->
<div id="isoPanel" class="stk-group hidden">
<h3 class="stk-group-t">Isosurface</h3>
<p class="stk-hint">Volumetric data from the cube file. Positive and negative lobes are drawn in blue and red.</p>
<div class="si-range-row">
<label class="si-range-label" for="isoPosVal">+ Isovalue</label>
<input type="range" id="isoPosVal" min="0.001" max="0.2" step="0.001" value="0.02" class="stk-range">
<span id="isoPosDisplay" class="si-range-val">0.02</span>
</div>
<div class="si-range-row">
<label class="si-range-label" for="isoNegVal">− Isovalue</label>
<input type="range" id="isoNegVal" min="-0.2" max="-0.001" step="0.001" value="-0.02" class="stk-range">
<span id="isoNegDisplay" class="si-range-val">-0.02</span>
</div>
<div class="si-range-row">
<label class="si-range-label" for="isoOpacity">Opacity</label>
<input type="range" id="isoOpacity" min="0.1" max="1" step="0.05" value="0.7" class="stk-range">
<span id="isoOpacityDisplay" class="si-range-val">0.7</span>
</div>
<div class="si-btn-row">
<button type="button" id="applyIso" class="stk-btn stk-btn-sm stk-btn-primary si-grow">Render isosurface</button>
<button type="button" id="clearIso" class="stk-btn stk-btn-sm">Clear</button>
</div>
</div>
</div>
<div class="si-tabs-wrap">
<div class="stk-tabs stk-tabs-fill" role="tablist" aria-label="Viewer settings">
<button type="button" id="tabStyleBtn" class="stk-tab" role="tab" aria-selected="true" aria-controls="tabStyle" data-tab="tabStyle">Style</button>
<button type="button" id="tabDisplayBtn" class="stk-tab" role="tab" aria-selected="false" aria-controls="tabDisplay" data-tab="tabDisplay" tabindex="-1">Display</button>
<button type="button" id="tabToolsBtn" class="stk-tab" role="tab" aria-selected="false" aria-controls="tabTools" data-tab="tabTools" tabindex="-1">Tools</button>
<button type="button" id="tabExportBtn" class="stk-tab" role="tab" aria-selected="false" aria-controls="tabExport" data-tab="tabExport" tabindex="-1">Export</button>
</div>
</div>
<!-- TAB: Style -->
<div id="tabStyle" class="si-tabpanel" role="tabpanel" aria-labelledby="tabStyleBtn">
<div class="stk-group">
<h3 class="stk-group-t">Representation</h3>
<div class="stk-field">
<label for="styleSelect">Style</label>
<select id="styleSelect" class="stk-select">
<option value="stick">Stick</option>
<option value="ballstick">Ball and stick</option>
<option value="sphere">Sphere (van der Waals)</option>
<option value="cross">Cross</option>
<option value="line">Wireframe</option>
<option value="cartoon">Cartoon (protein, nucleic acid)</option>
</select>
</div>
<div class="stk-field">
<label for="colorSelect">Colour</label>
<select id="colorSelect" class="stk-select">
<option value="element">By element (Jmol)</option>
<option value="chain">By chain</option>
<option value="residue">By residue</option>
<option value="bFactor">By B-factor</option>
<option value="spectrum">Spectrum (rainbow)</option>
<option value="ss">By secondary structure</option>
<option value="custom">Custom, per element</option>
</select>
</div>
<div id="perElementColorContainer" class="si-elem-list stk-scroll hidden"></div>
</div>
<div class="stk-group">
<h3 class="stk-group-t">Selection styling</h3>
<p class="stk-hint">Apply a different style to a subset of atoms, on top of the base representation.</p>
<div class="si-grid-2">
<div class="stk-field">
<label for="selChain">Chain</label>
<select id="selChain" class="stk-select stk-select-sm"><option value="">All chains</option></select>
</div>
<div class="stk-field">
<label for="selElem">Element</label>
<select id="selElem" class="stk-select stk-select-sm"><option value="">All elements</option></select>
</div>
</div>
<div class="stk-field">
<label for="selResn">Residue</label>
<select id="selResn" class="stk-select stk-select-sm"><option value="">All residues</option></select>
</div>
<details class="stk-disclosure">
<summary>Advanced query</summary>
<div>
<input id="selQuery" type="text" placeholder="e.g. resi:1-50 atom:CA ss:h" class="stk-input stk-input-sm stk-mono" autocomplete="off" spellcheck="false" aria-label="Selection query">
<p class="stk-hint">Overrides the dropdowns when filled. Same syntax as the Tools tab.</p>
</div>
</details>
<div class="stk-field">
<label for="selStyle">Style for the selection</label>
<div class="si-btn-row">
<select id="selStyle" class="stk-select stk-select-sm si-grow">
<option value="stick">Stick</option>
<option value="ballstick">Ball and stick</option>
<option value="sphere">Sphere</option>
<option value="cartoon">Cartoon</option>
<option value="cartoontube">Cartoon (tube)</option>
<option value="line">Wireframe</option>
<option value="hidden">Hide</option>
</select>
<button type="button" id="applySelStyle" class="stk-btn stk-btn-sm stk-btn-primary">Apply</button>
</div>
</div>
<div class="si-check-row">
<label class="stk-check"><input type="checkbox" id="selStyleUseColor"><span>Override colour</span></label>
<input type="color" id="selStyleColor" value="#f59e0b" class="si-color hidden" aria-label="Override colour">
</div>
<button type="button" id="clearSelStyles" class="stk-btn stk-btn-sm stk-btn-ghost si-self-start">Clear selection styles</button>
</div>
</div>
<!-- TAB: Display -->
<div id="tabDisplay" class="si-tabpanel" role="tabpanel" aria-labelledby="tabDisplayBtn" hidden>
<div class="stk-group">
<h3 class="stk-group-t">Labels</h3>
<div class="stk-switch-row">
<span>Atom labels <span id="atomLabelWarn" class="stk-badge stk-badge-warn hidden"></span></span>
<button type="button" id="toggleAtomLabels" class="stk-switch" role="switch" aria-checked="false" aria-label="Atom labels"></button>
</div>
<div class="stk-switch-row">
<span>Residue labels <span id="resLabelWarn" class="stk-badge stk-badge-warn hidden"></span></span>
<button type="button" id="toggleResLabels" class="stk-switch" role="switch" aria-checked="false" aria-label="Residue labels"></button>
</div>
<div class="stk-field">
<label for="labelScope">Label scope</label>
<select id="labelScope" class="stk-select stk-select-sm">
<option value="selection" selected>Current selection</option>
<option value="visible">Visible atoms</option>
<option value="all">Everything</option>
</select>
<p class="stk-hint">Scoping to a selection keeps labels usable on large systems. Over the limit, the atoms nearest the centre of the view win.</p>
</div>
<div id="labelLimitRow" class="hidden">
<div class="si-range-row">
<label class="si-range-label" for="labelLimit">Limit</label>
<input type="range" id="labelLimit" min="100" max="10000" step="100" value="1500" class="stk-range">
<span id="labelLimitVal" class="si-range-val">1,500</span>
</div>
<label class="stk-check si-mt-2"><input type="checkbox" id="labelForce"><span>Allow labels above 50,000 atoms (may freeze the tab)</span></label>
</div>
</div>
<div class="stk-group">
<h3 class="stk-group-t">View</h3>
<div class="stk-switch-row"><span>Show hydrogens</span><button type="button" id="toggleHydrogens" class="stk-switch" role="switch" aria-checked="true" aria-label="Show hydrogens"></button></div>
<div class="stk-switch-row"><span>Axis indicator</span><button type="button" id="toggleAxis" class="stk-switch" role="switch" aria-checked="false" aria-label="Axis indicator"></button></div>
<div class="stk-switch-row"><span>Spin</span><button type="button" id="toggleSpin" class="stk-switch" role="switch" aria-checked="false" aria-label="Spin"></button></div>
<div class="stk-switch-row"><span>Click to inspect atoms</span><button type="button" id="toggleClickInspect" class="stk-switch" role="switch" aria-checked="true" aria-label="Click to inspect atoms"></button></div>
<div class="stk-switch-row"><span>Outline</span><button type="button" id="toggleOutline" class="stk-switch" role="switch" aria-checked="false" aria-label="Outline"></button></div>
</div>
<div class="stk-group">
<h3 class="stk-group-t">Surface</h3>
<div class="si-btn-row">
<button type="button" id="surfaceBtn" class="stk-btn stk-btn-sm">Toggle surface</button>
<select id="surfaceType" class="stk-select stk-select-sm si-grow" aria-label="Surface type">
<option value="VDW">Van der Waals</option>
<option value="SAS">Solvent accessible</option>
<option value="SES">Solvent excluded</option>
<option value="MS">Molecular</option>
</select>
</div>
<label class="stk-check"><input type="checkbox" id="surfaceSelOnly"><span>Only the current selection</span></label>
<div class="si-range-row">
<label class="si-range-label" for="surfaceOpacity">Opacity</label>
<input type="range" id="surfaceOpacity" min="0.05" max="1" step="0.05" value="0.6" class="stk-range">
<span id="surfaceOpacityVal" class="si-range-val">0.6</span>
</div>
<div class="stk-field">
<label for="surfaceColorScheme">Surface colour</label>
<div class="si-btn-row">
<select id="surfaceColorScheme" class="stk-select stk-select-sm si-grow">
<option value="white">White</option>
<option value="element">By element</option>
<option value="chain">By chain</option>
<option value="bFactor">By B-factor</option>
<option value="spectrum">Spectrum</option>
<option value="custom">Custom</option>
</select>
<input type="color" id="surfaceCustomColor" value="#ffffff" class="si-color hidden" aria-label="Custom surface colour">
</div>
</div>
</div>
<div class="stk-group">
<h3 class="stk-group-t">Slab</h3>
<p class="stk-hint">Clip the scene in front of and behind the centre of rotation.</p>
<div class="si-range-row">
<label class="si-range-label" for="slabNear">Near</label>
<input type="range" id="slabNear" min="-100" max="0" step="1" value="-100" class="stk-range">
<span id="slabNearVal" class="si-range-val">Off</span>
</div>
<div class="si-range-row">
<label class="si-range-label" for="slabFar">Far</label>
<input type="range" id="slabFar" min="0" max="100" step="1" value="100" class="stk-range">
<span id="slabFarVal" class="si-range-val">Off</span>
</div>
<button type="button" id="resetSlab" class="stk-btn stk-btn-sm stk-btn-ghost si-self-start">Reset slab</button>
</div>
<div class="stk-group">
<h3 class="stk-group-t">Background</h3>
<select id="bgSelect" class="stk-select stk-select-sm" aria-label="Background colour">
<option value="theme">Match theme</option>
<option value="black">Black</option>
<option value="white">White</option>
<option value="grey">Grey</option>
</select>
</div>
<div class="stk-group">
<h3 class="stk-group-t">Camera</h3>
<button type="button" id="centerBtn" class="stk-btn stk-btn-sm"><i class="fa-solid fa-arrows-to-dot"></i>Recentre</button>
<div class="si-grid-3">
<button type="button" data-axis="xy-pos" class="axis-btn stk-btn stk-btn-sm">XY <span class="si-dim">+Z</span></button>
<button type="button" data-axis="xz-pos" class="axis-btn stk-btn stk-btn-sm">XZ <span class="si-dim">+Y</span></button>
<button type="button" data-axis="yz-pos" class="axis-btn stk-btn stk-btn-sm">YZ <span class="si-dim">+X</span></button>
<button type="button" data-axis="xy-neg" class="axis-btn stk-btn stk-btn-sm">XY <span class="si-dim">−Z</span></button>
<button type="button" data-axis="xz-neg" class="axis-btn stk-btn stk-btn-sm">XZ <span class="si-dim">−Y</span></button>
<button type="button" data-axis="yz-neg" class="axis-btn stk-btn stk-btn-sm">YZ <span class="si-dim">−X</span></button>
</div>
<p class="stk-hint">View plane, with the axis pointing at the camera.</p>
</div>
</div>
<!-- TAB: Tools -->
<div id="tabTools" class="si-tabpanel" role="tabpanel" aria-labelledby="tabToolsBtn" hidden>
<div class="stk-group">
<h3 class="stk-group-t">Measure</h3>
<p class="stk-hint">In measure mode, click two atoms for a distance or three for an angle.</p>
<div class="si-btn-row">
<button type="button" id="measureModeBtn" class="stk-btn stk-btn-sm si-grow" aria-pressed="false"><i class="fa-solid fa-ruler"></i>Measure mode</button>
<button type="button" id="clearMeasures" class="stk-btn stk-btn-sm">Clear all</button>
</div>
<label class="stk-check"><input type="checkbox" id="measureMode3"><span>Angle mode (pick three atoms)</span></label>
<div class="si-btn-row">
<button type="button" id="measureZoomBtn" class="stk-btn stk-btn-sm si-grow"><i class="fa-solid fa-magnifying-glass-plus"></i>Zoom to picks</button>
<button type="button" id="measureCopyBtn" class="stk-btn stk-btn-sm si-grow"><i class="fa-solid fa-clipboard"></i>Copy data</button>
</div>
<details class="stk-disclosure">
<summary>Measurement appearance</summary>
<div>
<div class="si-range-row si-range-row-color">
<label class="si-range-label" for="measureLineWidth">Line</label>
<input type="color" id="measureLineColor" value="#facc15" class="si-color" aria-label="Line colour" title="Line colour">
<input type="range" id="measureLineWidth" min="0.01" max="0.3" step="0.01" value="0.04" class="stk-range">
<span id="measureLineWidthVal" class="si-range-val">0.04</span>
</div>
<label class="stk-check"><input type="checkbox" id="measureDashed" checked><span>Dashed line</span></label>
<div class="si-range-row">
<label class="si-range-label" for="measureMarkerSize">Markers</label>
<input type="range" id="measureMarkerSize" min="0" max="1.2" step="0.05" value="0.4" class="stk-range">
<span id="measureMarkerSizeVal" class="si-range-val">0.40</span>
</div>
<div class="si-range-row si-range-row-color">
<label class="si-range-label" for="measureLabelSize">Label</label>
<input type="color" id="measureLabelColor" value="#fef08a" class="si-color" aria-label="Label colour" title="Label colour">
<input type="range" id="measureLabelSize" min="8" max="28" step="1" value="11" class="stk-range">
<span id="measureLabelSizeVal" class="si-range-val">11</span>
</div>
<label class="stk-check"><input type="checkbox" id="measureLabelBg" checked><span>Label background</span></label>
<div class="si-btn-row">
<div class="stk-field si-grow">
<label for="measureDecimals">Decimals</label>
<select id="measureDecimals" class="stk-select stk-select-sm">
<option value="0">0</option>
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
</select>
</div>
<label class="stk-check si-self-end"><input type="checkbox" id="measureShowUnit" checked><span>Show unit</span></label>
</div>
</div>
</details>
</div>
<div class="stk-group">
<h3 class="stk-group-t">Figure mode</h3>
<label class="stk-check"><input type="checkbox" id="measureFocusToggle"><span>Fade everything except the measured atoms</span></label>
<p class="stk-hint">The picked atoms keep the full representation; the rest drops to a faint context style so the geometry reads clearly in a figure.</p>
<div id="measureFocusPanel" class="si-stack hidden">
<label class="stk-check"><input type="checkbox" id="measureFocusRes" checked><span>Keep whole residues in focus</span></label>
<div class="stk-field">
<label for="measureContextStyle">Context style</label>
<div class="si-btn-row">
<select id="measureContextStyle" class="stk-select stk-select-sm si-grow">
<option value="wire" selected>Wireframe</option>
<option value="stick">Thin stick</option>
<option value="cartoon">Cartoon</option>
<option value="hide">Hidden</option>
</select>
<input type="color" id="measureContextColor" value="#94a3b8" class="si-color" aria-label="Context colour" title="Context colour">
</div>
</div>
<div class="si-range-row">
<label class="si-range-label" for="measureContextOpacity">Fade</label>
<input type="range" id="measureContextOpacity" min="0.03" max="1" step="0.01" value="0.15" class="stk-range">
<span id="measureContextOpacityVal" class="si-range-val">0.15</span>
</div>
</div>
</div>
<div class="stk-group">
<h3 class="stk-group-t">Selection builder</h3>
<p class="stk-hint">Combine the filters below, then isolate, highlight or zoom. With auto-isolate on, the view follows every change.</p>
<div class="si-grid-2">
<div class="stk-field">
<label for="buildResn">Residue</label>
<select id="buildResn" class="stk-select stk-select-sm interactive-select"><option value="">All residues</option></select>
</div>
<div class="stk-field">
<label for="buildElem">Element</label>
<select id="buildElem" class="stk-select stk-select-sm interactive-select"><option value="">All elements</option></select>
</div>
<div class="stk-field">
<label for="buildChain">Chain</label>
<select id="buildChain" class="stk-select stk-select-sm interactive-select"><option value="">All chains</option></select>
</div>
<div class="stk-field">
<label for="buildResi">Residue number</label>
<input id="buildResi" type="text" placeholder="e.g. 1-50" class="stk-input stk-input-sm stk-mono" autocomplete="off" spellcheck="false">
</div>
</div>
<div class="si-check-row">
<label class="stk-check"><input type="checkbox" id="buildNot"><span>Invert</span></label>
<label class="stk-check"><input type="checkbox" id="buildByres"><span>Whole residues</span></label>
</div>
<div id="buildWithinRow" class="si-range-row">
<label class="si-range-label" for="buildWithin">Within</label>
<input type="range" id="buildWithin" min="0" max="20" step="0.5" value="0" class="stk-range">
<span id="buildWithinVal" class="si-range-val">off</span>
</div>
<p class="stk-hint">Expands the selection to every atom within this distance of it, for binding pockets.</p>
<div class="stk-field si-mt-2">
<label for="spatialMode">Spatial region</label>
<div class="si-btn-row">
<select id="spatialAxis" class="stk-select stk-select-sm si-w-axis" aria-label="Axis">
<option value="z">Z</option>
<option value="y">Y</option>
<option value="x">X</option>
</select>
<select id="spatialMode" class="stk-select stk-select-sm si-grow">
<option value="">No spatial filter</option>
<option value="range">Range (from, to)</option>
<option value="center">Centre and width</option>
<option value="top">Top surface</option>
<option value="bottom">Bottom surface</option>
</select>
</div>
</div>
<div id="spatialControls" class="si-stack hidden">
<div id="spatialRangeControls" class="si-stack hidden">
<div class="si-range-row">
<label class="si-range-label" for="spatialFrom">From</label>
<input type="range" id="spatialFrom" min="0" max="100" step="0.1" value="0" class="stk-range">
<span id="spatialFromVal" class="si-range-val">0.0</span>
</div>
<div class="si-range-row">
<label class="si-range-label" for="spatialTo">To</label>
<input type="range" id="spatialTo" min="0" max="100" step="0.1" value="100" class="stk-range">
<span id="spatialToVal" class="si-range-val">100.0</span>
</div>
</div>
<div id="spatialCenterControls" class="si-stack hidden">
<div class="si-range-row">
<label class="si-range-label" for="spatialCenter">Centre</label>
<input type="range" id="spatialCenter" min="0" max="100" step="0.1" value="50" class="stk-range">
<span id="spatialCenterVal" class="si-range-val">50.0</span>
</div>
<div class="si-range-row">
<label class="si-range-label" for="spatialWidth">± Width</label>
<input type="range" id="spatialWidth" min="0.5" max="50" step="0.5" value="5" class="stk-range">
<span id="spatialWidthVal" class="si-range-val">5.0</span>
</div>
</div>
<div id="spatialSurfaceControls" class="si-stack hidden">
<div class="si-range-row">
<label class="si-range-label" for="spatialDepth">Depth</label>
<input type="range" id="spatialDepth" min="0.5" max="30" step="0.5" value="5" class="stk-range">
<span id="spatialDepthVal" class="si-range-val">5.0 Å</span>
</div>
</div>
<label class="stk-check"><input type="checkbox" id="enableCrossAxis"><span>Clamp the other two axes</span></label>
<div id="crossAxisControls" class="si-stack si-sub hidden">
<span class="si-sub-t" id="crossAxisLabel">Perpendicular axes</span>
<div class="si-range-row">
<label class="si-range-label" id="crossA_label" for="crossA_from">X from</label>
<input type="range" id="crossA_from" min="0" max="100" step="0.1" class="stk-range">
<span id="crossA_fromVal" class="si-range-val">0.0</span>
</div>
<div class="si-range-row">
<label class="si-range-label" id="crossA_toLabel" for="crossA_to">X to</label>
<input type="range" id="crossA_to" min="0" max="100" step="0.1" class="stk-range">
<span id="crossA_toVal" class="si-range-val">100.0</span>
</div>
<div class="si-range-row">
<label class="si-range-label" id="crossB_label" for="crossB_from">Y from</label>
<input type="range" id="crossB_from" min="0" max="100" step="0.1" class="stk-range">
<span id="crossB_fromVal" class="si-range-val">0.0</span>
</div>
<div class="si-range-row">
<label class="si-range-label" id="crossB_toLabel" for="crossB_to">Y to</label>
<input type="range" id="crossB_to" min="0" max="100" step="0.1" class="stk-range">
<span id="crossB_toVal" class="si-range-val">100.0</span>
</div>
</div>
<div class="stk-field">
<label for="spatialUnit">Unit</label>
<select id="spatialUnit" class="stk-select stk-select-sm">
<option value="A" selected>Ångström (Å)</option>
<option value="nm">Nanometre (nm)</option>
</select>
</div>
</div>
<label class="stk-check"><input type="checkbox" id="autoUpdateView" checked><span>Auto-isolate on change</span></label>
<div class="si-btn-row">
<button type="button" id="guiIsolateBtn" class="stk-btn stk-btn-sm stk-btn-primary si-grow"><i class="fa-solid fa-filter"></i>Isolate</button>
<button type="button" id="guiHighlightBtn" class="stk-btn stk-btn-sm si-grow"><i class="fa-solid fa-highlighter"></i>Highlight</button>
<button type="button" id="guiZoomBtn" class="stk-btn stk-btn-sm si-grow"><i class="fa-solid fa-crosshairs"></i>Zoom</button>
</div>
<p id="selectionCount" class="stk-hint stk-tnum hidden" role="status"><i class="fa-solid fa-atom"></i> <span id="selCountText">0 atoms selected</span></p>
<button type="button" class="reset-view-btn stk-btn stk-btn-sm stk-btn-ghost si-self-start">Reset view (show all)</button>
</div>
<div class="stk-group">
<h3 class="stk-group-t">
<label for="focusQuery">Query</label>
<select id="queryUnit" class="stk-select stk-select-sm si-w-unit" aria-label="Distance unit for the query">
<option value="nm">nm</option>
<option value="A" selected>Å</option>
</select>
</h3>
<input id="focusQuery" type="text" placeholder="e.g. z:>4.8 resn:HOH or chain:A elem:Fe" class="stk-input stk-input-sm stk-mono" autocomplete="off" spellcheck="false">
<div class="si-btn-row">
<button type="button" id="focusBtn" class="stk-btn stk-btn-sm si-grow"><i class="fa-solid fa-crosshairs"></i>Zoom to query</button>
<button type="button" id="isolateBtn" class="stk-btn stk-btn-sm">Isolate</button>
<button type="button" id="exportSelBtn" class="stk-btn stk-btn-sm stk-btn-icon" aria-label="Save the current selection as a PDB file" title="Save the current selection as a PDB file"><i class="fa-solid fa-file-export"></i></button>
</div>
<button type="button" class="reset-view-btn stk-btn stk-btn-sm stk-btn-ghost si-self-start">Reset view (show all)</button>
<details class="stk-disclosure">
<summary>Syntax guide and examples</summary>
<div class="si-guide">
<p class="stk-hint">Click an example to load it into the query box. Tokens are combined with AND.</p>
<div class="si-guide-grid">
<div><span class="query-example">chain:A</span>Chain ID</div>
<div><span class="query-example">resn:HOH</span>Residue name</div>
<div><span class="query-example">resi:1-50</span>Residue range</div>
<div><span class="query-example">elem:Fe</span>Element symbol</div>
<div><span class="query-example">atom:CA</span>Atom name</div>
<div><span class="query-example">ss:h</span>Secondary structure</div>
<div><span class="query-example">b:>30</span>B-factor filter</div>
<div><span class="query-example">serial:1-99</span>Serial range</div>
</div>
<p class="si-guide-h">Named groups</p>
<div class="si-guide-grid">
<div><span class="query-example">protein:1</span>Amino acids</div>
<div><span class="query-example">nucleic:1</span>DNA and RNA</div>
<div><span class="query-example">solvent:1</span>Water</div>
<div><span class="query-example">ion:1</span>Common ions</div>
<div><span class="query-example">backbone:1</span>N, CA, C, O</div>
<div><span class="query-example">sidechain:1</span>Non-backbone</div>
</div>
<p class="si-guide-h">Logic and distance</p>
<code class="query-example si-guide-code" data-query="within:5,resn:HEM">within:5,resn:HEM</code>
<p>Everything within 5 Å of the haem group, a binding pocket.</p>
<code class="query-example si-guide-code" data-query="not:solvent:1">not:solvent:1</code>
<p>Strip the water. Prefix any token with <b>not:</b> or <b>!</b> to invert it.</p>
<code class="query-example si-guide-code" data-query="or:chain:A|chain:B">or:chain:A|chain:B</code>
<p>Union of clauses separated by <b>|</b>.</p>
<code class="query-example si-guide-code" data-query="within:5,chain:A not:chain:A byres:1">within:5,chain:A not:chain:A byres:1</code>
<p>The interface: whole residues near chain A but not part of it.</p>
<p class="si-guide-h">Spatial filters (Å or nm)</p>
<code class="query-example si-guide-code" data-query="z:>4.8 resn:HOH">z:>4.8 resn:HOH</code>
<p>Atoms above z = 4.8 that are water.</p>
<code class="query-example si-guide-code" data-query="x:20-30 y:20-30">x:20-30 y:20-30</code>
<p>Cross-section patch in the XY plane.</p>
</div>
</details>
</div>
</div>
<!-- TAB: Export -->
<div id="tabExport" class="si-tabpanel" role="tabpanel" aria-labelledby="tabExportBtn" hidden>
<div class="stk-group">
<h3 class="stk-group-t">PNG image</h3>
<div class="stk-field">
<label for="exportQuality">Scale</label>
<div class="si-btn-row">
<select id="exportQuality" class="stk-select stk-select-sm si-grow">
<option value="1">1×</option>
<option value="2" selected>2×</option>
<option value="4">4×</option>
<option value="6">6×</option>
<option value="8">8×</option>
<option value="10">10×</option>
</select>
<output id="exportDims" class="si-dims stk-tnum" for="exportQuality" aria-live="polite"></output>
</div>
<p class="stk-hint">Multiples of the on-screen canvas. Resize the viewer, or hide the panel, to change the base size.</p>
</div>
<label class="stk-check"><input type="checkbox" id="exportTransparent"><span>Transparent background</span></label>
<div id="exportWarn" class="stk-callout stk-callout-warn" role="status" hidden>
<i class="fa-solid fa-triangle-exclamation"></i>
<span id="exportWarnText"></span>
</div>
<button type="button" id="downloadBtn" class="stk-btn stk-btn-primary"><i class="fa-solid fa-download"></i>Download PNG</button>
<p id="exportNote" class="stk-hint">Requests beyond the GPU's texture limit are clamped to the largest safe size rather than blacking out the canvas.</p>
</div>
</div>
</aside>
<div id="sidebarHandle" class="si-handle" role="separator" aria-orientation="vertical" aria-valuemin="280" aria-valuemax="480" aria-valuenow="320" aria-label="Resize the panel. Arrow keys adjust, double-click resets." title="Drag to resize, double-click to reset" tabindex="0"></div>
<!-- VIEWER -->
<div id="viewerColumn" class="si-viewer stk-shell-main">
<div class="si-stage">
<div id="viewerCanvas" class="absolute inset-0 w-full h-full cursor-move" aria-label="3D structure" role="img"></div>
<div class="si-status">
<div id="modeBadge" class="si-badge hidden" role="status"></div>
<div id="labelProgress" class="si-progress stk-tnum hidden" role="status"></div>
</div>
<dl id="atomInfo" class="si-overlay si-atom stk-kv" aria-live="polite"></dl>
<div id="busyOverlay" class="hidden" role="status">
<div class="busy-card"><span class="busy-spin" aria-hidden="true"></span><span id="busyText">Working</span></div>
</div>
</div>
<div id="measureInfo" class="si-measure" hidden></div>
<div class="stk-toolbar si-toolbar" role="toolbar" aria-label="Viewer controls">
<button type="button" id="tbReset" class="stk-btn stk-btn-icon" aria-label="Reset view" title="Reset view (R)"><i class="fa-solid fa-arrows-to-dot"></i></button>
<button type="button" id="tbSpin" class="stk-btn stk-btn-icon" aria-label="Spin" aria-pressed="false" title="Spin (S)"><i class="fa-solid fa-rotate"></i></button>
<span class="stk-toolbar-sep" aria-hidden="true"></span>
<button type="button" id="tbMeasure" class="stk-btn stk-btn-icon" aria-label="Measure mode" aria-pressed="false" title="Measure mode (M)"><i class="fa-solid fa-ruler"></i></button>
<button type="button" id="tbHydrogens" class="stk-btn stk-btn-icon" aria-label="Show hydrogens" aria-pressed="true" title="Show hydrogens (H)"><span class="si-glyph" aria-hidden="true">H</span></button>
<button type="button" id="tbLabels" class="stk-btn stk-btn-icon" aria-label="Atom labels" aria-pressed="false" title="Atom labels (L)"><i class="fa-solid fa-tag"></i></button>
<span class="stk-toolbar-sep" aria-hidden="true"></span>
<button type="button" id="tbScreenshot" class="stk-btn stk-btn-icon" aria-label="Save PNG with the current export settings" title="Save PNG"><i class="fa-solid fa-camera"></i></button>
<button type="button" id="tbFullscreen" class="stk-btn stk-btn-icon" aria-label="Fullscreen" aria-pressed="false" title="Fullscreen (F)"><i class="fa-solid fa-expand"></i></button>
<button type="button" id="tbPanel" class="stk-btn stk-btn-icon si-desktop-only" aria-label="Show panel" aria-pressed="true" title="Show or hide the panel"><i class="fa-solid fa-table-columns"></i></button>
<span class="stk-toolbar-sep" aria-hidden="true"></span>
<button type="button" id="tbHelp" class="stk-btn stk-btn-icon" aria-label="Keyboard shortcuts" title="Keyboard shortcuts (?)"><i class="fa-solid fa-question"></i></button>
</div>
</div>
</section>
<section class="stk-section" id="how-to-use" aria-label="How to use this tool">
<div class="stk-wrap">
<span class="stk-chip"><i class="fa-solid fa-microscope"></i> How-To Guide</span>
<h2 class="stk-h2">How to inspect a molecular structure</h2>
<p class="stk-lead">Load a coordinate file, choose how it should be drawn, then carve out the part you actually care about, all rendered locally by your GPU, with no upload step.</p>
<div class="stk-grid stk-grid-2">
<div class="stk-step"><span class="stk-num">1</span><div><h3>Load a structure</h3><p>Drag in a <strong>PDB, GRO, XYZ, CIF, MOL2, CUBE</strong> or other coordinate file, or type a four-character <strong>PDB ID</strong> to pull it straight from RCSB.</p></div></div>
<div class="stk-step"><span class="stk-num">2</span><div><h3>Pick a representation</h3><p>Choose cartoon for proteins, stick or ball-and-stick for small molecules, sphere for packing. Colour by element, chain, B-factor, secondary structure, or set every element by hand.</p></div></div>
<div class="stk-step"><span class="stk-num">3</span><div><h3>Narrow the selection</h3><p>Use the builder dropdowns for chain, residue and element, add a <strong>within</strong> radius for binding pockets, or slice along an axis with the spatial sliders. <strong>Isolate</strong> hides everything else; <strong>Highlight</strong> keeps the context as a faint wireframe.</p></div></div>
<div class="stk-step"><span class="stk-num">4</span><div><h3>Measure and export</h3><p>Click two atoms for a distance or three for an angle, switch on <strong>Figure mode</strong> to fade the surrounding structure, restyle the lines and labels to taste, then save a high-resolution PNG or copy the numbers as a table.</p></div></div>
</div>
<div class="stk-note" style="margin-top:1.5rem;">
<i class="fa-solid fa-keyboard" style="margin-top:.15rem;"></i>
<div><strong>Keyboard shortcuts.</strong> <span class="stk-kbd">R</span> recentre · <span class="stk-kbd">M</span> measure mode · <span class="stk-kbd">H</span> hydrogens · <span class="stk-kbd">L</span> labels · <span class="stk-kbd">S</span> spin · <span class="stk-kbd">Esc</span> cancel. Shortcuts are ignored while you are typing in a field.</div>
</div>
</div>
</section>
<section class="stk-section" id="how-it-works" aria-label="How it works">
<div class="stk-wrap">
<h2 class="stk-h2">How the viewer works</h2>
<div class="stk-grid stk-grid-3">
<div class="stk-card">
<h3>WebGL rendering</h3>
<p>Geometry is built and rasterised by <strong>3Dmol.js</strong> on your graphics card. Because the whole scene lives in GPU memory, rotation and zoom stay smooth on structures with hundreds of thousands of atoms, but every style change has to rebuild that geometry, which is why very large systems take a moment to re-draw.</p>
</div>
<div class="stk-card">
<h3>Selections are JSON, not strings</h3>
<p>3Dmol filters atoms with plain JavaScript objects such as <code>{chain:'A', resn:'HEM'}</code>. The query box compiles your text into exactly that shape, so anything you type here maps directly onto the library's own API, useful if you later script the same selection yourself.</p>
</div>
<div class="stk-card">
<h3>Neighbour search</h3>
<p>Distance queries (<code>within:</code>) index the target atoms into a uniform grid first, then test only the cells that could fall inside the radius. That keeps a pocket selection near-instant instead of comparing every atom against every other atom.</p>
</div>
</div>
<div class="stk-grid stk-grid-2" style="margin-top:1rem;">
<div class="stk-card">
<h3>Labels are built across frames</h3>
<p>Placing thousands of labels in one synchronous loop is what freezes a tab, nothing paints until the last one is done. Labels here are added in slices of about 150 per animation frame, with a progress readout, so the viewer stays interactive and you can watch them fill in. Starting a new label pass cancels the one in flight rather than queueing a second.</p>
</div>
<div class="stk-card">
<h3>Scope beats capping</h3>
<p>A cap alone still labels whichever atoms happen to come first in the file, which is rarely what you are looking at. Set <strong>Label scope</strong> to <em>Current selection</em> to label only what you isolated; when a scope still exceeds the limit, the atoms nearest the centre of the view are kept in preference to the rest.</p>
</div>
</div>
<div class="stk-note" style="margin-top:1rem;">
<i class="fa-solid fa-circle-info" style="margin-top:.15rem;"></i>
<div><strong>Labels are the usual bottleneck.</strong> Each label is a separate textured sprite, so tens of thousands of them will stall the browser long before the atoms themselves do. Labels are capped by default, warned about above 5,000 atoms, and disabled entirely above 50,000, raise the cap only when you have isolated a small region.</div>
</div>
</div>
</section>
<section class="stk-section" id="selection-syntax" aria-label="Selection syntax reference">
<div class="stk-wrap" style="max-width:56rem;">
<span class="stk-chip"><i class="fa-solid fa-terminal"></i> Selection Syntax</span>
<h2 class="stk-h2">The selection language</h2>
<p class="stk-lead">Every token is <code>key:value</code>, separated by spaces. Tokens are combined with <strong>AND</strong>, <code>chain:A elem:Fe</code> means iron atoms in chain A. Prefix any token with <code>not:</code> (or <code>!</code>) to invert just that token.</p>
<h3 class="stk-refs-h">Atom attributes</h3>
<table class="stk-syntax">
<thead><tr><th>Token</th><th>Selects</th></tr></thead>
<tbody>
<tr><td><code>chain:A</code></td><td><p>Chain identifier as written in the file.</p></td></tr>
<tr><td><code>resn:HOH</code></td><td><p>Residue name. Accepts comma lists: <code>resn:ALA,GLY</code>.</p></td></tr>
<tr><td><code>resi:1-50</code></td><td><p>Residue number: a single value, a comma list, or an inclusive range.</p></td></tr>
<tr><td><code>elem:Fe</code></td><td><p>Element symbol, case sensitive as stored in the file.</p></td></tr>
<tr><td><code>atom:CA</code></td><td><p>Atom name | more specific than element (<code>CA</code> is the alpha carbon).</p></td></tr>
<tr><td><code>ss:h</code></td><td><p>Secondary structure: <code>h</code> helix, <code>s</code> sheet, <code>c</code> coil.</p></td></tr>
<tr><td><code>b:>30</code></td><td><p>B-factor. Supports <code>></code>, <code><</code>, <code>>=</code>, <code><=</code> and ranges like <code>b:20-50</code>.</p></td></tr>
<tr><td><code>serial:1-99</code></td><td><p>Atom serial number range.</p></td></tr>
</tbody>
</table>
<h3 class="stk-refs-h">Named groups</h3>
<table class="stk-syntax">
<thead><tr><th>Token</th><th>Selects</th></tr></thead>
<tbody>
<tr><td><code>protein:1</code></td><td><p>Standard amino-acid residues.</p></td></tr>
<tr><td><code>nucleic:1</code></td><td><p>DNA and RNA residues.</p></td></tr>
<tr><td><code>solvent:1</code></td><td><p>Water under its common names (HOH, WAT, SOL, TIP3…).</p></td></tr>
<tr><td><code>ion:1</code></td><td><p>Frequently seen monatomic ions.</p></td></tr>
<tr><td><code>backbone:1</code></td><td><p>Protein backbone atoms N, CA, C, O.</p></td></tr>
<tr><td><code>sidechain:1</code></td><td><p>Amino-acid atoms that are not backbone.</p></td></tr>
<tr><td><code>hetero:1</code></td><td><p>Atoms flagged as HETATM | ligands, cofactors, solvent.</p></td></tr>
</tbody>
</table>
<h3 class="stk-refs-h">Geometry and logic</h3>
<table class="stk-syntax">
<thead><tr><th>Token</th><th>Selects</th></tr></thead>
<tbody>
<tr><td><code>x:>4.8</code></td><td><p>Cartesian coordinate filter on <code>x</code>, <code>y</code> or <code>z</code>. Ranges work too: <code>z:10-20</code>. Values follow the unit dropdown (Å or nm).</p></td></tr>
<tr><td><code>within:5,chain:A</code></td><td><p>Every atom within 5 Å of anything matching the inner selection. The radius comes first, then a comma, then a nested query.</p></td></tr>
<tr><td><code>not:resn:HOH</code></td><td><p>Inverts the token that follows. <code>!resn:HOH</code> is equivalent.</p></td></tr>
<tr><td><code>or:chain:A|chain:B</code></td><td><p>Union of the pipe-separated clauses.</p></td></tr>
<tr><td><code>byres:1</code></td><td><p>Expands the result so that any residue with one selected atom is selected entirely.</p></td></tr>
</tbody>
</table>
<h3 class="stk-refs-h">Worked examples</h3>
<table class="stk-syntax">
<thead><tr><th>Query</th><th>Meaning</th></tr></thead>
<tbody>
<tr><td><code>within:5,resn:HEM byres:1</code></td><td><p>The complete residues lining the haem pocket, the standard way to picture a binding site.</p></td></tr>
<tr><td><code>within:5,chain:A not:chain:A byres:1</code></td><td><p>The protein–protein interface: residues close to chain A that belong to a different chain.</p></td></tr>
<tr><td><code>protein:1 not:solvent:1 b:>60</code></td><td><p>The most mobile parts of the protein | often loops and termini.</p></td></tr>
<tr><td><code>ss:h chain:A</code></td><td><p>Helices of chain A only.</p></td></tr>
<tr><td><code>z:>30 not:solvent:1</code></td><td><p>The upper leaflet of a membrane system with water stripped out.</p></td></tr>
</tbody>
</table>
<h3 class="stk-refs-h">References & documentation</h3>
<ol class="stk-refs-list">
<li>Rego, N., & Koes, D. (2015). 3Dmol.js: molecular visualization with WebGL. <em>Bioinformatics</em>, 31(8), 1322–1324. <a href="https://doi.org/10.1093/bioinformatics/btu829" target="_blank" rel="noopener">doi:10.1093/bioinformatics/btu829</a></li>
<li>3Dmol.js API, <a href="https://3dmol.csb.pitt.edu/doc/AtomSelectionSpec.html" target="_blank" rel="noopener">AtomSelectionSpec reference</a> (University of Pittsburgh).</li>
<li>Berman, H. M., et al. (2000). The Protein Data Bank. <em>Nucleic Acids Research</em>, 28(1), 235–242. <a href="https://www.rcsb.org/" target="_blank" rel="noopener">rcsb.org</a></li>
<li>Wikipedia: <a href="https://en.wikipedia.org/wiki/Accessible_surface_area" target="_blank" rel="noopener">Accessible surface area</a> · <a href="https://en.wikipedia.org/wiki/Debye%E2%80%93Waller_factor" target="_blank" rel="noopener">B-factor</a>.</li>
</ol>
</div>
</section>
<section class="stk-section" id="faq" aria-label="Frequently asked questions">
<div class="stk-wrap" style="max-width:52rem;">
<h2 class="stk-h2">Frequently asked questions</h2>
<div style="margin-top:1rem;">
<details class="stk-faq"><summary>Is my structure uploaded anywhere?</summary><div>No. Files are read with the browser's FileReader and rendered by 3Dmol.js on your own GPU. The only network request the tool ever makes is the optional PDB ID fetch, which asks RCSB for that one public entry.</div></details>
<details class="stk-faq"><summary>Which file formats are supported?</summary><div>PDB, ENT, CIF/mmCIF, SDF, MOL, MOL2, XYZ, GRO, PQR, PRMTOP, MMTF, CDJSON, CUBE and VASP/POSCAR/CONTCAR. Multi-frame files load as a trajectory and expose the frame slider automatically.</div></details>
<details class="stk-faq"><summary>Why does the cartoon style show nothing?</summary><div>Cartoon rendering needs backbone connectivity and secondary-structure information, which only protein and nucleic-acid formats carry. A bare XYZ file or a small organic molecule has no backbone to trace, use stick or ball-and-stick instead.</div></details>
<details class="stk-faq"><summary>Why are my labels capped or disabled?</summary><div>Every label is an individual sprite, so they cost far more than the atoms do. Above 5,000 atoms the tool warns you and exposes a cap; above 50,000 it refuses labels outright to stop the tab freezing. Isolate a smaller region first, then label it.</div></details>
<details class="stk-faq"><summary>My high-resolution export came out smaller than I asked for.</summary><div>WebGL contexts have a maximum texture size, commonly 4,096, 8,192 or 16,384 pixels depending on the GPU. Requesting a multiplier beyond that limit would black out the canvas, so the export is clamped to the largest safe size and the panel tells you what you actually got.</div></details>
<details class="stk-faq"><summary>What is the difference between Isolate and Highlight?</summary><div>Isolate hides everything outside the selection, giving you a clean figure. Highlight keeps the rest of the structure as a faint wireframe so the selection stays in context, usually the better choice when you are explaining where something sits.</div></details>
<details class="stk-faq"><summary>Which surface type should I use?</summary><div>Van der Waals is fastest and shows atomic radii. Solvent-accessible traces the centre of a rolling probe and is what most buried-area calculations use. Solvent-excluded (Connolly) hugs the molecule more tightly and looks best in figures, but costs the most to compute.</div></details>
<details class="stk-faq"><summary>Turning on labels used to freeze the tab. What changed?</summary><div>Labels are now built in small slices spread across animation frames instead of one blocking loop, so the browser keeps painting and you get a live progress count. They are also scoped (by default to your current selection) and when a scope exceeds the limit the atoms nearest the centre of the view are kept. Above 50,000 atoms labels stay off unless you explicitly opt in, and even then the same chunking applies.</div></details>
<details class="stk-faq"><summary>How do I make a clean measurement figure?</summary><div>Take your measurements, then enable <strong>Figure mode</strong> in the Tools tab. Everything except the measured atoms drops to a faint wireframe (or thin stick, cartoon, or hidden entirely) at an opacity you control, while the picked atoms keep the full representation. Open <em>Measurement appearance</em> to set the line colour, thickness and dash, marker size, label size and colour, decimal places and whether units are shown. Use <em>Zoom to picks</em> to frame the shot, then export at 4× or higher.</div></details>
<details class="stk-faq"><summary>Can I get the measurement numbers out as data?</summary><div>Yes, <strong>Copy data</strong> puts every measurement on the clipboard as tab-separated text with type, atoms, value and unit columns, which pastes straight into a spreadsheet. Individual measurements can be removed with the × beside each row in the readout.</div></details>
<details class="stk-faq"><summary>Why does building a surface still pause the viewer?</summary><div>Surface meshing happens inside a single synchronous call in 3Dmol.js, so unlike labels it cannot be sliced across frames. What the tool does instead is paint a busy indicator first and start the work on the next frame, so you get feedback rather than a dead tab, and it refuses outright above 100,000 atoms. Scope the surface to your selection with <em>Only current selection</em> to keep it fast.</div></details>
<details class="stk-faq"><summary>Can I script the same selections elsewhere?</summary><div>Yes, the query box compiles to a 3Dmol AtomSelectionSpec object, so a query like <code>chain:A resn:HEM</code> is simply <code>{chain:'A', resn:'HEM'}</code> in the library's own API. Open the console and call <code>app.select('within:5,resn:HEM')</code> to get the matching atoms back as an array.</div></details>
</div>
<div class="stk-refs">
<a href="https://3dmol.csb.pitt.edu/doc/AtomSelectionSpec.html" target="_blank" rel="noopener"><i class="fa-solid fa-book"></i> AtomSelectionSpec reference</a><a href="https://doi.org/10.1093/bioinformatics/btu829" target="_blank" rel="noopener"><i class="fa-solid fa-quote-right"></i> Cite 3Dmol.js</a><a href="https://www.rcsb.org/" target="_blank" rel="noopener"><i class="fa-solid fa-database"></i> RCSB Protein Data Bank</a>
</div>
<p class="stk-credit">Runs entirely in your browser, no data leaves your device. Rendering by <a href="https://3dmol.csb.pitt.edu/" target="_blank" rel="noopener" style="color:#4f46e5;text-decoration:none;">3Dmol.js</a> (Rego & Koes, 2015).</p>
</div>
</section>
</main>
<footer class="mt-auto border-t border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-950 py-12">
<div class="max-w-7xl mx-auto px-6">
<div class="stk-dir mb-12">
<div>
<h4><i class="fa-solid fa-chart-pie text-indigo-500 text-xs"></i> Data & Stats</h4>
<ul>
<li><a href="plot-digitizer.html">Plot Digitizer</a></li>
<li><a href="data-cleaner.html">Data Cleaner</a></li>
<li><a href="stats-calculator.html">Stat Calculator</a></li>
<li><a href="error-bar-generator.html">Error Bar Gen</a></li>
<li><a href="outlier-detector.html">Outlier Detector</a></li>
<li><a href="curve-fitter.html">Curve Fitter</a></li>
<li><a href="plot-builder.html">Plot Builder</a></li>
<li><a href="xvg-visualizer.html">XVG Visualizer</a></li>
</ul>
</div>
<div>
<h4><i class="fa-solid fa-microchip text-orange-500 text-xs"></i> Compute</h4>
<ul>
<li><a href="structure-inspector.html">3D Inspector</a></li>
<li><a href="coordinate-manipulator.html">Coordinate Manipulator</a></li>
<li><a href="scientific-converter.html">Scientific Converter</a></li>
<li><a href="script-generator.html">HPC Script Gen</a></li>
</ul>
</div>
<div>
<h4><i class="fa-solid fa-book-open text-teal-500 text-xs"></i> Writing & Citations</h4>
<ul>
<li><a href="latex-formatter.html">Equation Formatter</a></li>
<li><a href="latex-tables.html">Visual LaTeX Tables</a></li>
<li><a href="doi-fetcher.html">DOI to BibTeX</a></li>
<li><a href="bibtex-deduplicator.html">BibTeX Deduplicator</a></li>
<li><a href="bibtex-sanitizer.html">BibTeX Sanitizer</a></li>
<li><a href="journal-abbreviator.html">Journal Abbrev</a></li>
</ul>
</div>
<div>
<h4><i class="fa-solid fa-headphones text-fuchsia-500 text-xs"></i> Focus & Flow</h4>
<ul>
<li><a href="pomodoro.html">Ambient Pomodoro</a></li>
<li><a href="decision.html">Decision Matrix</a></li>
<li><a href="sandbox.html">Kinetic Sandbox</a></li>
</ul>
</div>
</div>
<div class="border-t border-slate-200 dark:border-slate-800 pt-8 flex flex-col md:flex-row items-center justify-between text-slate-500 dark:text-slate-400 gap-4">
<div class="flex items-center gap-2">
<i class="fa-solid fa-flask text-xl text-slate-300 dark:text-slate-700"></i>
<span class="font-bold text-slate-700 dark:text-slate-300">STEMKit</span>
</div>
<div class="text-center text-sm font-medium">© 2026 STEMKit. Built by <a href="https://github.com/LD-Shell" target="_blank" rel="noopener" class="font-semibold hover:text-indigo-500 transition-colors">Olanrewaju M. Daramola</a>.</div>
<div class="flex gap-6 text-sm font-medium">
<a href="privacy.html#privacy" class="hover:text-indigo-500 transition-colors">Privacy Policy</a>
<a href="privacy.html#terms" class="hover:text-indigo-500 transition-colors">Terms of Service</a>
</div>
</div>
</div>
</footer>
<!-- Keyboard shortcut sheet -->
<div id="shortcutSheet" class="stk-modal" role="dialog" aria-modal="true" aria-labelledby="shortcutTitle" hidden>
<div class="stk-modal-box">
<div class="stk-panel-h">
<h2 id="shortcutTitle" class="stk-panel-t"><i class="fa-solid fa-keyboard"></i>Keyboard shortcuts</h2>
<button type="button" id="shortcutClose" class="stk-btn stk-btn-ghost stk-btn-icon stk-btn-sm" aria-label="Close" title="Close"><i class="fa-solid fa-xmark"></i></button>
</div>
<div class="stk-panel-b">
<dl class="si-keys">
<dt><span class="stk-key">R</span></dt><dd>Reset the view</dd>
<dt><span class="stk-key">S</span></dt><dd>Spin on or off</dd>
<dt><span class="stk-key">M</span></dt><dd>Measure mode on or off</dd>
<dt><span class="stk-key">H</span></dt><dd>Show or hide hydrogens</dd>
<dt><span class="stk-key">L</span></dt><dd>Atom labels on or off</dd>
<dt><span class="stk-key">F</span></dt><dd>Fullscreen viewer</dd>
<dt><span class="stk-key">?</span></dt><dd>This sheet</dd>
<dt><span class="stk-key">Esc</span></dt><dd>Leave measure mode, close this sheet</dd>
</dl>
<p class="stk-hint si-mt-3">Shortcuts are ignored while a text field or a select has focus, and when a modifier key is held. Drag to rotate, scroll or right-drag to zoom, and drag with the middle button or with Ctrl held to translate.</p>
</div>
</div>
</div>
<!-- Full-page drop target, shown while a file is dragged over the page -->
<div id="dropIndicator" class="si-drop-indicator" hidden aria-hidden="true">
<div class="si-drop-card"><i class="fa-solid fa-file-arrow-up"></i><span>Drop the file to load it</span></div>
</div>
<div id="toastContainer" class="stk-toasts" aria-live="polite"></div>
<script src="js/structure-inspector.js"></script>
</body>
</html>