-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoordinate-manipulator.html
More file actions
564 lines (513 loc) · 54.2 KB
/
Copy pathcoordinate-manipulator.html
File metadata and controls
564 lines (513 loc) · 54.2 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
<!DOCTYPE html>
<html lang="en" class="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coordinate Manipulator | PDB & GRO Trajectories | STEMKit</title>
<meta name="title" content="Coordinate Manipulator | PDB & GRO Trajectories | STEMKit">
<meta name="description" content="Translate, rotate and centre molecular structures on their centre of mass, edit GROMACS box vectors, and convert between PDB, GRO and XYZ with automatic Å/nm handling, all in your browser.">
<meta name="keywords" content="coordinate manipulator, pdb translation, gro file editor, computational chemistry, center of mass pdb, xyz converter">
<link rel="canonical" href="https://stemkit.net/coordinate-manipulator.html">
<meta property="og:url" content="https://stemkit.net/coordinate-manipulator.html">
<meta property="twitter:url" content="https://stemkit.net/coordinate-manipulator.html">
<meta property="og:title" content="Coordinate Manipulator | PDB & GRO Trajectories">
<meta property="twitter:title" content="Coordinate Manipulator | PDB & GRO Trajectories">
<meta property="og:description" content="Apply rigid-body translation vectors and calculate bounding boxes for computational chemistry files locally.">
<meta property="twitter:description" content="Apply rigid-body translation vectors and calculate bounding boxes for computational chemistry files locally.">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "STEMKit Coordinate Manipulator",
"url": "https://stemkit.net/coordinate-manipulator.html",
"description": "Translate, rotate and centre molecular structures, compute centre of mass, edit simulation box vectors and convert between PDB, GRO and XYZ, entirely in the browser.",
"applicationCategory": "UtilityApplication",
"operatingSystem": "All",
"author": { "@type": "Person", "name": "Olanrewaju M. Daramola" },
"browserRequirements": "Requires JavaScript",
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
"featureList": [ "PDB/GRO/XYZ Parsing", "Vector Translation", "3D Rotation", "Centre of Mass Alignment", "Editable Simulation Box", "Format Conversion", "Client-Side Privacy" ]
}
</script>
<meta name="author" content="Olanrewaju M. Daramola">
<meta name="theme-color" content="#4f46e5">
<meta property="og:type" content="website">
<meta property="og:image" content="https://stemkit.net/assets/og-image.webp">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:image" content="https://stemkit.net/assets/og-image.webp">
<link rel="icon" type="image/x-icon" href="https://stemkit.net/assets/favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="https://stemkit.net/assets/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://stemkit.net/assets/favicon-16x16.png">
<link rel="apple-touch-icon" href="https://stemkit.net/assets/apple-touch-icon.png">
<script src="js/dependencies/3Dmol-min.js"></script>
<link rel="stylesheet" href="css/all.min.css">
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"HowTo","name":"Coordinate Manipulator","totalTime":"PT2M","tool":{"@type":"HowToTool","name":"Coordinate Manipulator"},"step":[{"@type":"HowToStep","position":1,"name":"Load a structure","text":"Drag & drop (or click to browse) a .pdb, .gro or .xyz file. Parsing starts automatically."},{"@type":"HowToStep","position":2,"name":"Inspect the system","text":"Read off the atom count, geometric centre and bounding box, all shown in the file’s native units (Å for PDB/XYZ, nm for GRO)."},{"@type":"HowToStep","position":3,"name":"Transform","text":"Enter a translation vector and click Apply Vector, or press Align Origin to move the geometric centre to (0, 0, 0)."},{"@type":"HowToStep","position":4,"name":"Export","text":"Choose an output format and click Download. Coordinates are converted to the correct units for the target format automatically."}]}
</script>
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Which units does each format use?","acceptedAnswer":{"@type":"Answer","text":"PDB and XYZ are in ångström; GROMACS .gro is in nanometres (1 nm = 10 Å). When you export to a different format, coordinates are converted automatically."}},{"@type":"Question","name":"Is the ‘Geometric Centre’ the centre of mass?","acceptedAnswer":{"@type":"Answer","text":"No. It is the arithmetic mean of the atomic coordinates (a geometric centroid). A true centre of mass would weight each atom by its atomic mass."}},{"@type":"Question","name":"Does translation distort my molecule?","acceptedAnswer":{"@type":"Answer","text":"No. Rigid-body translation and centring shift every atom by the same vector, so all internal distances and angles are preserved."}},{"@type":"Question","name":"Can I convert a GRO file to PDB?","acceptedAnswer":{"@type":"Answer","text":"Yes. Load the .gro and choose PDB (or XYZ) as the output format; the tool converts nm to Å during export."}},{"@type":"Question","name":"Is my structure file uploaded anywhere?","acceptedAnswer":{"@type":"Answer","text":"No. Files are read and processed entirely in your browser and are never transmitted to a server."}}]}
</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/coordinate-manipulator.css">
<script type="application/ld+json">
{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "Which units does each format use?", "acceptedAnswer": {"@type": "Answer", "text": "PDB and XYZ are in \u00e5ngstr\u00f6m; GROMACS .gro is in nanometres (1 nm = 10 \u00c5). When you export to a different format, coordinates are converted automatically, and every input label shows the unit currently in use."}}, {"@type": "Question", "name": "What is the difference between geometric centre and centre of mass?", "acceptedAnswer": {"@type": "Answer", "text": "The geometric centre is the plain arithmetic mean of the coordinates \u2014 every atom counts equally. The centre of mass weights each atom by its standard atomic weight, so it sits closer to the heavy atoms. Use centre of mass when setting up a simulation; the two can differ by several \u00e5ngstr\u00f6m in an asymmetric molecule."}}, {"@type": "Question", "name": "Which atomic weights are used?", "acceptedAnswer": {"@type": "Answer", "text": "IUPAC standard atomic weights covering hydrogen through the common heavy elements. If an element cannot be identified from the file the tool falls back to carbon and tells you which symbols were unrecognised, so a mass-weighted result is never silently wrong."}}, {"@type": "Question", "name": "How does the tool know CA is calcium and not an alpha carbon?", "acceptedAnswer": {"@type": "Answer", "text": "It checks the PDB element column first, which is authoritative when present. Failing that it reads the atom name, using the residue name to break ties: CA inside a residue named CA is calcium, while CA in ALA is the alpha carbon."}}, {"@type": "Question", "name": "In what order are rotations applied?", "acceptedAnswer": {"@type": "Answer", "text": "Intrinsic Z-Y-X \u2014 yaw about Z, then pitch about Y, then roll about X, equivalent to R = Rz\u00b7Ry\u00b7Rx acting on a column vector. Because rotations do not commute, apply one axis at a time if you need an exact orientation."}}, {"@type": "Question", "name": "Does rotation or translation distort my molecule?", "acceptedAnswer": {"@type": "Answer", "text": "No. Both are rigid-body operations: every internal distance and angle is preserved exactly. Only the position and orientation of the structure as a whole change."}}, {"@type": "Question", "name": "Can I set my own simulation box?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. The Simulation Box panel lets you type Lx, Ly and Lz in nanometres, or press Fit to Molecule to derive them from the bounding box with a padding percentage. If the source file carried a box \u2014 a .gro box line or a PDB CRYST1 record \u2014 it is loaded as the starting point. The tool warns you when the box is smaller than the molecule."}}, {"@type": "Question", "name": "Why does the preview stop after 500 lines?", "acceptedAnswer": {"@type": "Answer", "text": "Rendering a large system's full text into the page would freeze the browser. Only the first 500 lines are drawn; Download and Copy always give you the complete file, however large."}}, {"@type": "Question", "name": "Are velocities preserved in GRO files?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. If the input .gro carries velocity columns they are kept, rotated along with the coordinates, and written back out. Velocities are direction vectors, so translating the structure correctly leaves them unchanged."}}, {"@type": "Question", "name": "Can I convert a GRO file to PDB?", "acceptedAnswer": {"@type": "Answer", "text": "Yes. Load the .gro and choose PDB (or XYZ) as the output format; the tool converts nm to \u00c5 during export and writes the box as a CRYST1 record."}}, {"@type": "Question", "name": "Is my structure file uploaded anywhere?", "acceptedAnswer": {"@type": "Answer", "text": "No. Files are read and processed entirely in your browser and are never transmitted to a server."}}]}
</script>
</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 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">Digitizer Pro</a>
</div>
</div>
</div>
</nav>
<main class="stk-shell-tall flex-grow w-full flex flex-col relative">
<section id="uploadZone" class="absolute inset-0 z-10 flex flex-col items-center justify-center p-6 bg-slate-50 dark:bg-slate-950 transition-opacity duration-300">
<div class="w-full max-w-4xl flex flex-col items-center justify-center border-2 border-dashed border-purple-300 dark:border-purple-700 rounded-3xl bg-purple-50/50 dark:bg-purple-900/10 cursor-pointer p-20 text-center group transition-colors hover:bg-purple-50 dark:hover:bg-purple-900/20" id="dropArea">
<input type="file" id="fileInput" accept=".pdb,.gro,.xyz" class="hidden">
<div class="w-24 h-24 bg-purple-100 dark:bg-purple-900/50 rounded-3xl flex items-center justify-center mb-8 text-purple-600 dark:text-purple-400 group-hover:scale-110 transition-transform shadow-sm">
<i class="fa-solid fa-cube text-5xl"></i>
</div>
<h1 class="text-4xl font-black mb-4 tracking-tight">Coordinate Manipulator</h1>
<p class="text-slate-500 dark:text-slate-400 mb-2 max-w-lg leading-relaxed">
Parse topologies instantly. Apply rigid-body translation vectors, compute system dimensions, and convert output formats entirely in your browser.
</p>
<p class="text-xs font-bold text-slate-400 dark:text-slate-500 mb-8 uppercase tracking-wider">Supported formats: .pdb, .gro, .xyz</p>
<button class="bg-purple-600 hover:bg-purple-700 text-white px-8 py-3.5 rounded-xl font-bold shadow-lg transition-colors flex items-center gap-2">
<i class="fa-solid fa-file-import"></i> Initialize Topology
</button>
</div>
</section>
<section id="workspace" class="stk-shell hidden w-full flex-grow flex flex-col lg:flex-row p-4 gap-4 pb-12">
<div class="stk-shell-main w-full lg:w-[420px] bg-white dark:bg-slate-900 rounded-2xl border border-slate-200 dark:border-slate-800 flex flex-col overflow-hidden shadow-sm shrink-0">
<div class="p-5 border-b border-slate-100 dark:border-slate-800 bg-slate-50 dark:bg-slate-950 flex justify-between items-center">
<div>
<h2 class="text-base font-black tracking-tight flex items-center gap-2">
<i class="fa-solid fa-layer-group text-purple-500"></i> Transformation Engine
</h2>
<p id="systemFormatLabel" class="text-[10px] text-slate-500 font-mono mt-1 uppercase">Awaiting structure...</p>
</div>
<button id="btnCloseWorkspace" class="w-8 h-8 rounded-lg border border-slate-200 dark:border-slate-700 text-slate-400 hover:text-red-500 hover:border-red-200 dark:hover:border-red-800 transition-colors flex items-center justify-center">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<div class="flex-grow overflow-y-auto p-4 custom-scroll space-y-3">
<div class="border border-slate-200 dark:border-slate-700 rounded-xl overflow-hidden bg-white dark:bg-slate-900">
<button class="accordion-btn w-full px-4 py-3 bg-slate-50 dark:bg-slate-800/50 flex justify-between items-center text-left focus:outline-none" aria-expanded="true" data-target="statsContent">
<span class="text-xs font-bold text-slate-800 dark:text-slate-200 uppercase tracking-wider">System Statistics</span>
<i class="fa-solid fa-chevron-down accordion-icon text-slate-400 text-xs"></i>
</button>
<div id="statsContent" class="accordion-content expanded px-4 pb-4 pt-2">
<div class="grid grid-cols-2 gap-y-3 text-xs">
<div>
<span class="text-[10px] font-bold text-slate-400 block uppercase">Total Atoms</span>
<span id="statAtomCount" class="font-mono text-slate-700 dark:text-slate-300">0</span>
</div>
<div>
<span class="text-[10px] font-bold text-slate-400 block uppercase">Geometric Center</span>
<span id="statGeoCenter" class="font-mono text-slate-700 dark:text-slate-300">0.0, 0.0, 0.0</span>
</div>
<div>
<span class="text-[10px] font-bold text-slate-400 block uppercase">Centre of Mass</span>
<span id="statMassCenter" class="font-mono text-slate-700 dark:text-slate-300">0.0, 0.0, 0.0</span>
</div>
<div>
<span class="text-[10px] font-bold text-slate-400 block uppercase">Molecular Weight</span>
<span id="statMolWeight" class="font-mono text-slate-700 dark:text-slate-300">, </span>
<button id="btnMassDetail" type="button" class="ml-1 text-[10px] font-bold text-purple-600 dark:text-purple-400 hover:underline align-middle">how?</button>
</div>
<div class="col-span-2">
<span class="text-[10px] font-bold text-slate-400 block uppercase">Bounding Box (XYZ)</span>
<span id="statBoundingBox" class="font-mono text-slate-700 dark:text-slate-300">0.0 × 0.0 × 0.0</span>
</div>
<details id="massDetail" class="col-span-2 mt-3 border-t border-slate-200 dark:border-slate-800 pt-3">
<summary class="cursor-pointer text-[10px] font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400 hover:text-purple-500">How the mass was calculated</summary>
<div class="mt-2 text-[11px] leading-relaxed text-slate-600 dark:text-slate-400">
<p class="mb-2">Sum of standard atomic weights over every atom present in the file, including solvent and ions. Natural-isotope averages, not monoisotopic masses; no charge correction.</p>
<div id="massTable" class="overflow-x-auto"></div>
<p id="massAssumptions" class="mt-2 text-amber-700 dark:text-amber-400"></p>
<button id="btnMassDownload" type="button" class="mt-2 bg-slate-800 hover:bg-slate-700 text-white border border-slate-600 px-2.5 py-1 rounded-lg text-[10px] font-bold transition-all">Download working (.csv)</button>
</div>
</details>
</div>
</div>
</div>
<div class="border border-purple-200 dark:border-purple-800 rounded-xl overflow-hidden bg-purple-50/30 dark:bg-purple-900/10">
<div class="px-4 py-3 border-b border-purple-100 dark:border-purple-800/50 flex justify-between items-center">
<span class="text-xs font-bold text-purple-900 dark:text-purple-300 uppercase tracking-wider">Rigid-Body Translation</span>
</div>
<div class="p-4">
<p id="transUnitNote" class="text-[10px] text-slate-500 dark:text-slate-400 mb-3">Input vector components. Units match the parsed input file (.pdb = Å, .gro = nm).</p>
<div class="grid grid-cols-3 gap-2 mb-3">
<div>
<span id="labelTransX" class="text-[10px] font-bold text-slate-500 uppercase">Delta X</span>
<input type="number" id="transX" value="0.000" step="0.1" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
<div>
<span id="labelTransY" class="text-[10px] font-bold text-slate-500 uppercase">Delta Y</span>
<input type="number" id="transY" value="0.000" step="0.1" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
<div>
<span id="labelTransZ" class="text-[10px] font-bold text-slate-500 uppercase">Delta Z</span>
<input type="number" id="transZ" value="0.000" step="0.1" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
</div>
<div class="mb-3">
<span class="text-[10px] font-bold text-slate-500 uppercase">Centre using</span>
<select id="centerMode" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs outline-none mt-0.5">
<option value="geometric">Geometric centre (centroid)</option>
<option value="mass">Centre of mass (mass-weighted)</option>
</select>
</div>
<div class="flex gap-2">
<button id="btnCenterSys" class="flex-1 bg-slate-800 hover:bg-slate-700 text-white font-bold py-2 rounded-lg text-xs transition-colors shadow-sm">
<i class="fa-solid fa-crosshairs mr-1"></i> Align Origin
</button>
<button id="btnApplyTrans" class="flex-1 bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 rounded-lg text-xs transition-colors shadow-sm">
Apply Vector
</button>
</div>
</div>
</div>
<!-- ROTATION -->
<div class="border border-sky-200 dark:border-sky-800 rounded-xl overflow-hidden bg-sky-50/30 dark:bg-sky-900/10">
<div class="px-4 py-3 border-b border-sky-100 dark:border-sky-800/50 flex justify-between items-center">
<span class="text-xs font-bold text-sky-900 dark:text-sky-300 uppercase tracking-wider">3D Rotation</span>
<span class="text-[9px] font-mono text-sky-700 dark:text-sky-400">degrees</span>
</div>
<div class="p-4">
<p class="text-[10px] text-slate-500 dark:text-slate-400 mb-3">Applied as intrinsic Z‑Y‑X (yaw, then pitch, then roll) about the pivot below. Rigid rotation, bond lengths and angles are preserved.</p>
<div class="grid grid-cols-3 gap-2 mb-3">
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Rot X (°)</span>
<input type="number" id="rotX" value="0" step="5" min="-360" max="360" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Rot Y (°)</span>
<input type="number" id="rotY" value="0" step="5" min="-360" max="360" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Rot Z (°)</span>
<input type="number" id="rotZ" value="0" step="5" min="-360" max="360" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
</div>
<div class="mb-3">
<span class="text-[10px] font-bold text-slate-500 uppercase">Rotate about</span>
<select id="rotPivot" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs outline-none mt-0.5">
<option value="geometric">Geometric centre</option>
<option value="mass">Centre of mass</option>
<option value="origin">Origin (0, 0, 0)</option>
</select>
</div>
<div class="flex gap-2">
<button id="btnUndo" type="button" title="Nothing to undo" class="opacity-40 cursor-not-allowed bg-slate-800 hover:bg-slate-700 text-white border border-slate-600 font-bold py-2 px-3 rounded-lg text-xs transition-all mr-2 flex items-center gap-1.5"><i class="fa-solid fa-rotate-left"></i> Undo</button>
<button id="btnRedo" type="button" title="Nothing to redo" class="opacity-40 cursor-not-allowed bg-slate-800 hover:bg-slate-700 text-white border border-slate-600 font-bold py-2 px-3 rounded-lg text-xs transition-all mr-2 flex items-center gap-1.5"><i class="fa-solid fa-rotate-right"></i> Redo</button>
<button id="btnResetRot" class="flex-1 bg-slate-800 hover:bg-slate-700 text-white font-bold py-2 rounded-lg text-xs transition-colors shadow-sm">
<i class="fa-solid fa-rotate-left mr-1"></i> Reset Angles
</button>
<button id="btnApplyRot" class="flex-1 bg-sky-600 hover:bg-sky-700 text-white font-bold py-2 rounded-lg text-xs transition-colors shadow-sm">
Apply Rotation
</button>
</div>
</div>
</div>
<!-- SIMULATION BOX -->
<div id="boxPanel" class="border border-emerald-200 dark:border-emerald-800 rounded-xl overflow-hidden bg-emerald-50/30 dark:bg-emerald-900/10 transition-opacity">
<div class="px-4 py-3 border-b border-emerald-100 dark:border-emerald-800/50 flex justify-between items-center">
<span class="text-xs font-bold text-emerald-900 dark:text-emerald-300 uppercase tracking-wider">Simulation Box</span>
<span class="text-[9px] font-mono text-emerald-700 dark:text-emerald-400">GRO · <span id="boxUnitLabel">nm</span></span>
</div>
<div class="p-4">
<p class="text-[10px] text-slate-500 dark:text-slate-400 mb-3">Box vectors written to <code>.gro</code> output (and as <code>CRYST1</code> in PDB). GROMACS always expects nanometres here, whatever the source file used.</p>
<div class="grid grid-cols-3 gap-2 mb-3">
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Lx (nm)</span>
<input type="number" id="boxLx" value="0.00000" step="0.1" min="0" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Ly (nm)</span>
<input type="number" id="boxLy" value="0.00000" step="0.1" min="0" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Lz (nm)</span>
<input type="number" id="boxLz" value="0.00000" step="0.1" min="0" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
</div>
<div class="flex items-end gap-2 mb-2">
<div class="flex-1">
<span class="text-[10px] font-bold text-slate-500 uppercase">Padding (%)</span>
<input type="number" id="boxPad" value="10" step="5" min="0" max="200" class="w-full bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-700 rounded p-1.5 text-xs text-center font-mono">
</div>
<button id="btnBoxFromBounds" class="flex-1 bg-emerald-600 hover:bg-emerald-700 text-white font-bold py-2 rounded-lg text-xs transition-colors shadow-sm">
<i class="fa-solid fa-cube mr-1"></i> Fit to Molecule
</button>
</div>
<p id="boxSource" class="text-[10px] text-slate-500 dark:text-slate-400 font-mono"></p>
</div>
</div>
</div>
<div class="mt-auto p-4 bg-slate-50 dark:bg-slate-950 border-t border-slate-100 dark:border-slate-800 flex flex-col gap-3 rounded-b-3xl">
<div class="grid grid-cols-2 gap-2">
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Output Format</span>
<select id="exportFormat" class="w-full bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-2 text-xs outline-none">
<option value="xyz">Standard XYZ (.xyz)</option>
<option value="pdb">Protein Data Bank (.pdb)</option>
<option value="gro">GROMACS (.gro)</option>
</select>
</div>
<div>
<span class="text-[10px] font-bold text-slate-500 uppercase">Filename</span>
<input type="text" id="exportName" value="translated_sys" class="w-full bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-2 text-xs outline-none">
</div>
</div>
<p id="exportUnitNote" class="text-[10px] text-slate-500 dark:text-slate-400 font-mono"></p>
<div class="mb-4 border border-slate-200 dark:border-slate-800 rounded-xl overflow-hidden">
<div class="bg-slate-50 dark:bg-slate-950 px-3 py-2 flex justify-between items-center border-b border-slate-200 dark:border-slate-800">
<span class="text-[11px] font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400">Equivalent GROMACS command</span>
<button id="btnCopyEditconf" class="text-[10px] font-bold uppercase tracking-wider text-purple-600 dark:text-purple-400 hover:underline">Copy</button>
</div>
<pre class="p-3 overflow-x-auto text-[11px] leading-relaxed bg-white dark:bg-slate-900"><code id="editconfOut" class="font-mono text-slate-700 dark:text-slate-300">Load a structure to see the equivalent command.</code></pre>
<div id="editconfNotes" class="px-3 pb-3 text-[10px] leading-relaxed text-amber-700 dark:text-amber-400"></div>
</div>
<button id="btnDownload" class="w-full bg-purple-600 hover:bg-purple-500 text-white font-bold py-3 rounded-xl transition-all duration-200 transform hover:-translate-y-1 hover:shadow-lg active:scale-95 shadow-md text-sm flex justify-center items-center">
<i class="fa-solid fa-download mr-2 text-lg"></i> Download Coordinates
</button>
</div>
</div>
<div class="stk-shell-main flex-grow flex flex-col gap-4 min-w-0">
<div class="flex-grow bg-slate-100 dark:bg-slate-900 rounded-2xl border border-slate-200 dark:border-slate-800 shadow-sm flex flex-col relative overflow-hidden min-h-[240px]">
<div class="bg-white dark:bg-slate-950 px-4 py-3 flex justify-between items-center border-b border-slate-200 dark:border-slate-800 shrink-0">
<div class="flex flex-col">
<span class="text-sm font-bold text-purple-500 dark:text-purple-400 uppercase tracking-wider font-mono">Structure View</span>
<span id="viewerNote" class="text-[10px] text-slate-400 font-mono">Updates after every transformation</span>
</div>
<div class="flex gap-2">
<label class="flex items-center gap-1.5 text-xs text-slate-500 dark:text-slate-400 cursor-pointer select-none mr-1" title="Outline the simulation cell">
<input type="checkbox" id="showBox" checked class="accent-purple-500"> Box
</label>
<select id="viewerStyle" class="bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg px-2 py-1 text-xs outline-none">
<option value="stick">Sticks</option>
<option value="sphere">Spheres</option>
<option value="ballstick" selected>Ball & stick</option>
<option value="line">Wireframe</option>
</select>
<button id="btnViewerReset" class="bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 text-slate-700 dark:text-slate-200 px-3 py-1 rounded-lg text-xs font-bold transition-all" title="Recentre the view">
<i class="fa-solid fa-crosshairs"></i>
</button>
</div>
</div>
<div id="viewerCanvas" class="flex-grow relative w-full"></div>
<p id="viewerFallback" class="hidden absolute inset-0 flex items-center justify-center text-center text-xs text-slate-500 px-6"></p>
</div>
<div id="viewSplit" role="separator" aria-orientation="horizontal" tabindex="0"
aria-label="Drag to resize the structure view. Arrow keys adjust, double-click resets."
title="Drag to resize · double-click to reset"
class="hidden lg:flex shrink-0 h-5 -my-1 items-center justify-center cursor-row-resize group select-none focus:outline-none">
<span class="flex items-center gap-1.5 px-3 py-1 rounded-full border border-slate-300 dark:border-slate-700 bg-white dark:bg-slate-900 shadow-sm text-slate-400 group-hover:text-purple-500 group-hover:border-purple-400 group-focus:text-purple-500 group-focus:border-purple-400 transition-colors">
<i class="fa-solid fa-grip-lines text-[10px]"></i>
<span class="text-[10px] font-bold uppercase tracking-wider">Drag to resize</span>
</span>
</div>
<div id="previewPanel" class="stk-preview-pane bg-slate-900 rounded-2xl border border-slate-800 shadow-xl flex flex-col relative overflow-hidden shrink-0">
<div class="bg-slate-950 px-4 py-3 flex justify-between items-center border-b border-slate-800 shrink-0">
<div class="flex flex-col">
<span class="text-sm font-bold text-purple-400 uppercase tracking-wider font-mono">Data Buffer Preview</span>
<span id="previewNote" class="text-[10px] text-slate-500 font-mono"></span>
</div>
<button id="btnShowAll" class="hidden bg-slate-700 hover:bg-slate-600 text-white border border-slate-600 px-3 py-1.5 rounded-lg text-xs font-bold transition-all mr-2"></button>
<button id="btnCopyBuffer" class="bg-slate-800 hover:bg-slate-700 text-white px-3 py-1.5 rounded-lg text-xs font-bold transition-all shadow-md flex items-center gap-1">
<i class="fa-regular fa-copy"></i> Copy Buffer
</button>
</div>
<div class="flex-grow p-4 overflow-auto custom-scroll relative">
<pre><code id="coordOutput" class="text-emerald-400 font-mono text-xs leading-relaxed whitespace-pre select-all">Awaiting structure array...</code></pre>
</div>
</div>
</div>
</section>
</main>
<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-cubes"></i> How-To Guide</span>
<h2 class="stk-h2">How to translate and convert molecular coordinates</h2>
<p class="stk-lead">Shift a structure by a vector, centre it on the origin, or convert between PDB, GRO and XYZ (with correct unit handling) without installing anything.</p>
<div class="stk-grid stk-grid-3">
<div class="stk-step"><span class="stk-num">1</span><div><h3>Load a structure</h3><p>Drag & drop (or click to browse) a <code>.pdb</code>, <code>.gro</code> or <code>.xyz</code> file. Parsing starts automatically.</p></div></div><div class="stk-step"><span class="stk-num">2</span><div><h3>Inspect the system</h3><p>Read off the atom count, geometric centre and bounding box, all shown in the file’s native units (Å for PDB/XYZ, nm for GRO).</p></div></div><div class="stk-step"><span class="stk-num">3</span><div><h3>Transform</h3><p>Apply a translation vector, rotate about any axis in degrees, or press <strong>Align Origin</strong> to move either the geometric centre or the true centre of mass to (0, 0, 0).</p></div></div><div class="stk-step"><span class="stk-num">4</span><div><h3>Export</h3><p>Choose an output format and click <strong>Download</strong>. Coordinates are converted to the correct units for the target format automatically.</p></div></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 coordinate manipulator works</h2>
<div class="stk-grid stk-grid-2">
<div class="stk-card">
<h3 style="font-weight:700;margin-bottom:.4rem;">Units are handled for you</h3>
<p style="font-size:.88rem;color:#64748b;line-height:1.6;">PDB and XYZ files store coordinates in <strong>ångström (Å)</strong>; GROMACS <code>.gro</code> files use <strong>nanometres (nm)</strong>, where 1 nm = 10 Å. The tool keeps atoms in the source unit for display and transforms, then converts on export, so a <code>.gro</code> loaded in nm is written out as a valid <code>.pdb</code> in Å. Every input label updates to show the unit currently in force, so there is nothing to remember.</p>
</div>
<div class="stk-card">
<h3 style="font-weight:700;margin-bottom:.4rem;">Geometric centre vs centre of mass</h3>
<p style="font-size:.88rem;color:#64748b;line-height:1.6;">The <strong>geometric centre</strong> is the unweighted mean of the coordinates, every atom counts equally. The <strong>centre of mass</strong> weights each atom by its standard atomic weight, so heavy atoms pull it toward them. For a water molecule the two differ by roughly 0.28 Å. Both are shown live, and either can be moved to the origin.</p>
</div>
<div class="stk-card">
<h3 style="font-weight:700;margin-bottom:.4rem;">Rigid-body operations</h3>
<p style="font-size:.88rem;color:#64748b;line-height:1.6;">Translation adds a constant vector to every atom. Rotation applies an orthogonal matrix about a pivot you choose. Both are <em>rigid</em>: all bond lengths and angles are preserved, verified here to within floating-point precision. Velocities in a <code>.gro</code> file are rotated with the structure but never translated, since a velocity is a direction rather than a position.</p>
</div>
<div class="stk-card">
<h3 style="font-weight:700;margin-bottom:.4rem;">Big files stay responsive</h3>
<p style="font-size:.88rem;color:#64748b;line-height:1.6;">Painting a solvated system into the page would mean laying out millions of lines of text, which locks the tab. The preview therefore formats and shows only the first 500 lines, while <strong>Download</strong> and <strong>Copy</strong> always produce the complete file. A 200,000-atom system redraws its preview in about 25 ms.</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>On rotation order.</strong> Angles are applied as intrinsic Z‑Y‑X (yaw, then pitch, then roll) matching <code>R = Rz(γ)·Ry(β)·Rx(α)</code>. Rotations do not commute, so 90° about X then 90° about Y differs from the reverse order. For a precise orientation, apply one axis at a time.</div>
</div>
</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>Which units does each format use?</summary><div>PDB and XYZ are in ångström; GROMACS .gro is in nanometres (1 nm = 10 Å). When you export to a different format, coordinates are converted automatically, and every input label shows the unit currently in use.</div></details><details class="stk-faq"><summary>What is the difference between geometric centre and centre of mass?</summary><div>The geometric centre is the plain arithmetic mean of the coordinates, every atom counts equally. The centre of mass weights each atom by its standard atomic weight, so it sits closer to the heavy atoms. Use centre of mass when setting up a simulation; the two can differ by several ångström in an asymmetric molecule.</div></details><details class="stk-faq"><summary>Which atomic weights are used?</summary><div>IUPAC standard atomic weights covering hydrogen through the common heavy elements. If an element cannot be identified from the file the tool falls back to carbon and tells you which symbols were unrecognised, so a mass-weighted result is never silently wrong.</div></details><details class="stk-faq"><summary>How does the tool know CA is calcium and not an alpha carbon?</summary><div>It checks the PDB element column first, which is authoritative when present. Failing that it reads the atom name, using the residue name to break ties: CA inside a residue named CA is calcium, while CA in ALA is the alpha carbon.</div></details><details class="stk-faq"><summary>In what order are rotations applied?</summary><div>Intrinsic Z-Y-X, yaw about Z, then pitch about Y, then roll about X, equivalent to R = Rz·Ry·Rx acting on a column vector. Because rotations do not commute, apply one axis at a time if you need an exact orientation.</div></details><details class="stk-faq"><summary>Does rotation or translation distort my molecule?</summary><div>No. Both are rigid-body operations: every internal distance and angle is preserved exactly. Only the position and orientation of the structure as a whole change.</div></details><details class="stk-faq"><summary>Can I set my own simulation box?</summary><div>Yes. The Simulation Box panel lets you type Lx, Ly and Lz in nanometres, or press Fit to Molecule to derive them from the bounding box with a padding percentage. If the source file carried a box (a .gro box line or a PDB CRYST1 record) it is loaded as the starting point. The tool warns you when the box is smaller than the molecule.</div></details><details class="stk-faq"><summary>Why does the preview stop after 500 lines?</summary><div>Rendering a large system's full text into the page would freeze the browser. Only the first 500 lines are drawn; Download and Copy always give you the complete file, however large.</div></details><details class="stk-faq"><summary>Are velocities preserved in GRO files?</summary><div>Yes. If the input .gro carries velocity columns they are kept, rotated along with the coordinates, and written back out. Velocities are direction vectors, so translating the structure correctly leaves them unchanged.</div></details><details class="stk-faq"><summary>Can I convert a GRO file to PDB?</summary><div>Yes. Load the .gro and choose PDB (or XYZ) as the output format; the tool converts nm to Å during export and writes the box as a CRYST1 record.</div></details><details class="stk-faq"><summary>Is my structure file uploaded anywhere?</summary><div>No. Files are read and processed entirely in your browser and are never transmitted to a server.</div></details>
</div>
<div class="stk-refs">
<a href="https://www.wwpdb.org/documentation/file-format" target="_blank" rel="noopener"><i class="fa-solid fa-cube"></i> wwPDB: PDB file format</a><a href="https://manual.gromacs.org/current/reference-manual/file-formats.html" target="_blank" rel="noopener"><i class="fa-solid fa-atom"></i> GROMACS: .gro format</a><a href="https://www.ciaaw.org/atomic-weights.htm" target="_blank" rel="noopener"><i class="fa-solid fa-weight-hanging"></i> CIAAW: standard atomic weights</a><a href="https://en.wikipedia.org/wiki/Rotation_matrix" target="_blank" rel="noopener"><i class="fa-solid fa-rotate"></i> Rotation matrices</a>
</div>
<p class="stk-credit">Runs entirely in your browser, no data leaves your device.</p>
</div>
</section>
<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">Energy Conversions</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>
<div id="toastContainer" class="fixed bottom-6 right-6 z-50 flex flex-col gap-3 pointer-events-none"></div>
<script>
// 1. Theme toggle logic (Mobile & Desktop)
document.querySelectorAll('.themeToggle').forEach(btn => {
btn.addEventListener('click', () => {
document.documentElement.classList.toggle('dark');
localStorage.theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
});
});
// 2. Mobile menu logic
const mobileMenuBtn = document.getElementById('mobile-menu-btn');
const mobileMenu = document.getElementById('mobile-menu');
const menuIcon = document.getElementById('menu-icon');
if(mobileMenuBtn) {
mobileMenuBtn.addEventListener('click', () => {
mobileMenu.classList.toggle('hidden');
if(mobileMenu.classList.contains('hidden')) {
menuIcon.classList.remove('fa-xmark');
menuIcon.classList.add('fa-bars');
} else {
menuIcon.classList.remove('fa-bars');
menuIcon.classList.add('fa-xmark');
}
});
document.querySelectorAll('.mobile-link').forEach(link => {
link.addEventListener('click', () => {
mobileMenu.classList.add('hidden');
menuIcon.classList.remove('fa-xmark');
menuIcon.classList.add('fa-bars');
});
});
}
</script>
<script type="module" src="js/coordinate-manipulator.js"></script>
</body>
</html>