Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·3045 lines (2561 loc) · 153 KB
/
Copy pathindex.html
File metadata and controls
executable file
·3045 lines (2561 loc) · 153 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
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- This code uses much of the code from molSimplify Lite. There are additional buttons for solvent removal and thermal stability predictions, and many MOF centered operations (visualization, component identification, etc). An example MOF is prepared by default, using fetch.
In a terminal, navigate to folder containing app.py.
Then, to open the website, run python app.py in the terminal. Copy and paste http://0.0.0.0:8000/ into the search browser URL bar.
-->
<!-- Import NGL, webGavrog, and Bootstrap libraries-->
<!DOCTYPE html>
<html>
<head>
<script src="libraries/jquery-3.4.1.min.js">
</script>
<script src="libraries/ngl.js" type="text/javascript">
</script>
<script src="libraries/webGavrog/runtime.js" type="text/javascript">
</script>
<script src="libraries/webGavrog/vendors.js" type="text/javascript">
</script>
<script src="libraries/webGavrog/main.js" type="text/javascript">
</script>
<script src="libraries/3Dmol-min.js">
</script>
<script src="libraries/bootstrap.min.js">
</script>
<script src="https://cdn.bokeh.org/bokeh/release/bokeh-2.3.1.min.js">
</script><!-- Import CSS -->
<link href="libraries/bootstrap.min.css" rel="stylesheet">
<link href="libraries/bootstrap_custom.min.css" rel="stylesheet"><!-- Imports related to star rating -->
<link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-star-rating@4.1.0/css/star-rating.min.css" media="all" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-star-rating@4.1.0/js/star-rating.min.js" type="text/javascript">
</script>
<link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-star-rating@4.1.0/themes/krajee-svg/theme.css" media="all" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-star-rating@4.1.0/themes/krajee-svg/theme.js">
</script><!-- Custom CSS code is placed within the <style> tag: -->
<style>
.btn {
margin-top: 3px;
}
.mol-container {
/* For component visualization */
height: 400px;
position: relative;
}
.form-control {
margin-bottom: 0.1cm;
}
.round_button {
border-radius: 25px;
font-size: 16px;
font-weight: bold;
min-width: 130px;
}
.selection_button {
display: inline-block;
width: 33%;
}
.link {
/* hyperlinks are blue */
color: #279AF1;
}
.dropdown-item {
font-size: 18px;
}
#viewportwrapper {
/* For MOF visualization */
grid-area: viz;
}
#chart {
/* thermal breakdown plot is centered, when thermal stability prediction is made */
width: 100%;
text-align: center;
}
#header_background {
background-image: url('banner_light');
background-position: center; /* Keeps the banner centered even when window is shrunken */
background-size: cover; /* Makes the banner the appropriate size */
}
body {
/* The font to be used everywhere */
font-family: Arial, Helvetica, sans-serif;
color: black;
font-size: 16px;
}
.perm {
background: none;
border: none;
}
.pill-custom {
border-radius: 0px 0px 0px 0px !important;
border: 0px;
color: black !important;
background-color: white !important;
padding-left: 0px;
padding-right: 0px;
}
.pill-custom.active {
background-color: #f7f7f7 !important;
border-bottom: 5px solid black !important;
}
.pill-custom:hover {
color: #18bc9c !important;
}
</style><!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-7B1L0P0FXV">
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-7B1L0P0FXV');
</script><!-- End of Google Analytics stuff -->
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>MOFSimplify</title>
</head>
<body>
<!-- The following code creates a navbar. Each navbar item is in a list entry of class "nav-item". -->
<div class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="../" style='font-size: 30px; padding-right: 30px;'>MOFSimplify</a> <button aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-target="#navbarResponsive" data-toggle="collapse" type='button'><span class="navbar-toggler-icon"><!-- Toggle navbar --></span></button>
<div class="collapse navbar-collapse" id="navbarResponsive" style='font-size: 20px;'>
<ul class="navbar-nav">
<li class="nav-item dropdown" style='padding-right: 30px;'>
<a aria-expanded="false" aria-haspopup="true" class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" id="navbarDropdownMenuLink" role="button">Property prediction</a>
<div aria-labelledby="navbarDropdownMenuLink" class="dropdown-menu">
<a class="dropdown-item" href="../">Solvent/Thermal</a>
<a class="dropdown-item" href="water_stability_prediction.html">Water/Acid</a>
<a class="dropdown-item" href="C2_uptake_prediction.html">C2 uptake</a>
</div>
</li>
<li class="nav-item" style='padding-right: 30px;'>
<a class="nav-link" href="stable_MOFs.html">Stable MOFs</a>
</li>
<li class="nav-item" style='padding-right: 30px;'>
<a class="nav-link" href="how_to_cite.html">How to Cite</a>
</li>
<li class="nav-item dropdown" style='padding-right: 30px;'>
<a aria-expanded="false" aria-haspopup="true" class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" id="navbarDropdownMenuLink">Code</a>
<div aria-labelledby="navbarDropdownMenuLink" class="dropdown-menu">
<a class="dropdown-item" href="https://github.com/hjkgrp/MOFSimplify">Source Code</a> <a class="dropdown-item" href="https://github.com/hjkgrp/molSimplify/tree/master/molSimplify/Informatics/MOF">MOF Code</a>
</div>
</li>
</ul>
</div><button class='btn btn-primary round_button' id='dark_mode' style='font-size:22px; width:20%;' type='button'>Dark mode</button>
</div>
</div>
<div class="container">
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12" id='header_background'>
<!-- Title -->
<span style='position:relative;'><!-- The zebra class changes color depending if Dark mode is toggled on or not. --></span>
<p class='zebra' style="font-size: 27px; width:100%; text-align:center; font-style: italic; color: #2B3E50; margin-top: 6cm;"><span style='position:relative;'>The <a class="link" href="http://hjkgrp.mit.edu/">Kulik Group</a> at MIT<br>
Powered by <a class="link" href="https://molsimplify.readthedocs.io/en/latest/">molSimplify</a></span></p>
</div>
</div>
</div><!-- The 4 tabs of the website -->
<ul class="nav nav-pills mb-3" id="pills-tab" style="overflow-x: auto;text-align: center;margin-left:-15px;margin-right:-15px;margin-bottom: 10px;border-bottom-width: 1px;border-bottom-style: solid; border-bottom-color:#d6d9dc; flex-wrap:nowrap;">
<li class="nav-item" role="presentation" style='width:25%; min-width:150px;'><button class="nav-link pill-custom active" id="pills-main-tab" style='width:100%; height:100%; font-weight: bold; font-size:24px;'>Main</button></li>
<li class="nav-item" role="presentation" style='width:25%; min-width:150px;'><button class="nav-link pill-custom" id="pills-vis-tab" style='width:100%; height: 100%; font-weight: bold; font-size:24px;'>Visualization</button></li>
<li class="nav-item" role="presentation" style='width:25%; min-width:150px;'><button class="nav-link pill-custom" id="pills-comp-tab" style='width:100%; height: 100%; font-weight: bold; font-size:24px;'>Component Analysis</button></li>
<li class="nav-item" role="presentation" style='width:25%; min-width:150px;'><button class="nav-link pill-custom" id="pills-data-tab" style='width:100%; height: 100%; font-weight: bold; font-size:24px;'>Data Upload</button></li>
</ul><!-- The Main tab of the website -->
<div class="container" id="pills-main">
<b class='zebra' style='font-size:22px;'>1) Select a MOF (metal-organic framework) for analysis</b> <!-- Create a section containing buttons -->
<div class='col-lg-12'>
<div style='width:100%; text-align:center; margin-top:0.25cm;'>
<!-- Button for queuing up the example MOF cif file -->
<button class='btn btn-primary round_button selection_button' id='example-redirect' style='font-size:22px;' type='button'>Example MOF</button> <!-- Button for uploading MOF cif file -->
<button class='btn btn-primary round_button selection_button' id='upload' style='font-size:22px;' type='button'>Custom (upload cif file)</button> <!-- Button for generating MOF cif file -->
<button class='btn btn-primary round_button selection_button' id='bb-redirect' style='font-size:22px;' type='button'>Building block assembly</button>
<p class='zebra' id='cif_hint' style='display:inline-block; width:100%; font-size: 22px; margin-bottom: 0.25cm;'>Uploaded cif file must be disorder free and without floating solvent</p>
<p class='zebra' id='permission_line' style='font-size:22px;'>May MOFSimplify store information on your MOFs? <button class='perm' id='perm_yes' style='color: green;'>Yes.</button> <button class='perm' id='perm_no' style='color: red;'>No.</button></p><!--   is a space gap -->
</div>
</div>
<div id='predict_section' style='margin-top: 1cm;'>
<b class='zebra' style='font-size:22px;'>2) Predict properties of the selected MOF</b> <!-- Create a section containing buttons -->
<div class='col-lg-12'>
<div style='width:100%; text-align:center; margin-top:0.25cm;'>
<!-- Button for predicting solvent removal stability of MOF -->
<button class='btn btn-primary round_button' id='predict_s' style='display:inline-block; width:49%; font-size:22px;' type='button'>Stability upon solvent removal</button> <!-- Button for predicting thermal stability of MOF -->
<button class='btn btn-primary round_button' id='predict_t' style='display:inline-block; width:49%; font-size:22px;' type='button'>Thermal stability</button>
</div>
</div>
</div>
<div id='descriptor_section' style='margin-top: 1cm;'>
<b class='zebra' style='font-size:22px;'>3) Download descriptors of the selected MOF</b> <!-- Create a section containing buttons -->
<div class='col-lg-12'>
<div style='width:100%; text-align:center; margin-top:0.25cm;'>
<!-- Button for downloading descriptors of MOF -->
<button class='btn btn-primary round_button' id='download_descriptors' style='display:inline-block; width:49%; font-size:22px;' type='button'>Download descriptors</button>
</div>
</div>
</div><!-- Section where the MOF predictions are placed once predictions are made. Also displays which MOF is currently queued up and ready for analysis. -->
<div class='row' id='status_section' style='margin-top: 1cm;border-left:5px solid gray;border-color:#2c3e50;padding-left:5px;background-color:#f7f7f7;'>
<b style='font-size:22px;'>Status messages and MOF predictions</b>
<div class='col-12' id='upload_status' style='font-size:22px;'></div>
<div class='col-12' id='solvent_stability_prediction' style='font-size:22px;'></div>
<div class='col-12' id='solvent_form'>
<form action='/process_feedback' class='col-10' enctype="multipart/form-data" id='solvent_stability_feedback' method="post" name="solvent_stability_feedback" style='font-size:22px;margin-left:15px'>
<input name="feedback_form_name" type="hidden" value="solvent_stability"> <input name="cif_file_name" type="hidden" value=""> <input name="structure" type="hidden" value=""> <i id='rate_solvent'>Rate this prediction: *</i> <input class="rating" data-size="md" id="solvent_rating" name="rating" required="" type="text">
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="solvent_rating_email_desc">Email (.edu preferred) *</span>
</div><input aria-describedby="solvent_rating_email_desc" class="form-control" id="solvent_rating_email" name="email" required="" type="email">
</div><select class="form-control mt-2 mb-0" id="inputState_A" name="reason" required="">
<option value="">
Reason for rating... *
</option>
<option>
I've worked with this MOF before, the prediction is good
</option>
<option>
I've worked with this MOF before, the prediction is bad (please upload data)
</option>
<option>
The literature contains counter examples of this prediction (provide DOI of papers with counterexamples in Comments field)
</option>
<option>
The paper is incorrect (provide reasoning in Comments field)
</option>
<option>
The label obtained from the paper is incorrect (provide reasoning in Comments field)
</option>
</select>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="solvent_rating_comments_desc">Comments</span>
</div><input aria-describedby="solvent_rating_comments_desc" class="form-control" id="solvent_rating_comments" name="comments" type="text">
</div>
<div class="custom-file form-control mt-2">
<input class="custom-file-input" id="validatedCustomFile_A" name="file" type="file"> <label class="custom-file-label" for="validatedCustomFile_A" id="TGA_A">Upload TGA Trace (.pdf, .jpg, .png, .tiff; 20 MB max)</label>
<div class="invalid-feedback">
Example invalid custom file feedback
</div>
</div>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="solvent_rating_solvname_desc">Solvent evacuated for selected MOF</span>
</div><input aria-describedby="solvent_rating_solvname_desc" class="form-control" id="solvent_rating_solvname" name="solvent" type="text">
</div><button class="btn btn-primary mt-2" id="submit_A" type="submit">Submit</button>
</form>
</div>
<div class='col-12' id='thermal_stability_prediction' style='font-size:22px;'></div>
<div class='col-12' id='thermal_stability_percentile' style='font-size:22px;'></div>
<div class="col-12" id="thermal_form">
<form action='/process_feedback' class='col-10' enctype="multipart/form-data" id='thermal_stability_feedback' method="post" name="thermal_stability_feedback" style='font-size:22px;margin-left:15px'>
<input name="feedback_form_name" type="hidden" value="thermal_stability"> <input name="cif_file_name" type="hidden" value=""> <input name="structure" type="hidden" value=""> <i id='rate_thermal'>Rate this prediction: *</i> <input class="rating" data-size="md" id="thermal_rating" name="rating" required="" type="text">
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="thermal_rating_email_desc">Email (.edu preferred) *</span>
</div><input aria-describedby="thermal_rating_email_desc" class="form-control" id="thermal_rating_email" name="email" required="" type="email">
</div><select class="form-control mt-2 mb-0" id="inputState_B" name="reason" required="">
<option value="">
Reason for rating... *
</option>
<option>
I've worked with this MOF before, the prediction is good
</option>
<option>
I've worked with this MOF before, the prediction is bad (please upload data)
</option>
<option>
The literature contains counter examples of this prediction (provide DOI of papers with counterexamples in Comments field)
</option>
<option>
The paper is incorrect (provide reasoning in Comments field)
</option>
<option>
The label obtained from the paper is incorrect (provide reasoning in Comments field)
</option>
</select>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="thermal_rating_comments_desc">Comments</span>
</div><input aria-describedby="thermal_rating_comments_desc" class="form-control" id="thermal_rating_comments" name="comments" type="text">
</div>
<div class="custom-file form-control mt-2">
<input class="custom-file-input" id="validatedCustomFile_B" name="file" type="file"> <label class="custom-file-label" for="validatedCustomFile_B" id="TGA_B">Upload TGA Trace (.pdf, .jpg, .png, .tiff; 20 MB max)</label>
<div class="invalid-feedback">
Example invalid custom file feedback
</div>
</div>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="thermal_rating_solvname_desc">Solvent evacuated for selected MOF</span>
</div><input aria-describedby="thermal_rating_solvname_desc" class="form-control" id="thermal_rating_solvname" name="solvent" type="text">
</div><button class="btn btn-primary mt-2" id="submit_B" type="submit">Submit</button>
</form>
</div>
<div class='col-12' id='chart' style='font-size:22px;'></div>
</div>
<div class='row' id='neighbor_blurb'>
<p class='col-12 zebra' style='margin-top: 0.5cm; font-size:22px;'>Nearest neighbors come from the pool of training data (i.e. <a class='link' href='https://zenodo.org/record/3370144#.YQBeCC1h2L2'>CoRE MOFs</a>) used to train an ANN.</p>
</div>
<div class='row'>
<div class='col-6 zebra' id='solvent_neighbor_section' style='font-size:22px;'>
Solvent removal stability ANN nearest neighbors<br>
in latent space <select class='form-control' id='solvent_neighbors' style='font-size:22px;'>
</select>
<div style='width:100%; text-align:center; margin-top:0.5cm;'>
<button class='btn btn-primary round_button' id='s_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Show</button> <button class='btn btn-primary round_button' id='download_s_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Download</button>
</div>
<div style='width:100%; text-align:center;'>
<button class='btn btn-primary round_button' id='visualize_s_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Visualize</button> <button class='btn btn-primary round_button' id='comp_s_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Get components</button>
</div>
<p class='zebra' id='s_neighbor_info' style='font-size:20px;'></p><!-- Feedback form for solvent neighbor -->
<div id="solvent_neighbor_form">
<form action='/process_feedback' class='col-10' enctype="multipart/form-data" id='solvent_stability_neighbor_feedback' method="post" name="solvent_stability_neighbor_feedback" style='font-size:22px;margin-left:15px'>
<input name="feedback_form_name" type="hidden" value="solvent_stability_neighbor"> <input name="cif_file_name" type="hidden" value=""> <input name="structure" type="hidden" value=""> <i>Rate this existing data: *</i> <input class="rating" data-size="md" id="solvent_neighbor_rating" name="rating" required="" type="text">
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="solvent_neighbor_rating_email_desc">Email (.edu preferred) *</span>
</div><input aria-describedby="solvent_neighbor_rating_email_desc" class="form-control" id="solvent_neighbor_rating_email" name="email" required="" type="email">
</div><select class="form-control mt-2 mb-0" id="inputState_C" name="reason" required="">
<option value="">
Reason for rating... *
</option>
<option>
I've worked with this MOF before, the deposited data is good
</option>
<option>
I've worked with this MOF before, the deposited data is bad (please upload data)
</option>
<option>
The literature contains counter examples of this deposited data (provide DOI of papers with counterexamples in comment field)
</option>
<option>
The paper is incorrect (provide reasoning in comment field)
</option>
<option>
The label obtained from the paper is incorrect (provide reasoning in comment field)
</option>
</select>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="solvent_neighbor_rating_comments_desc">Comments</span>
</div><input aria-describedby="solvent_neighbor_rating_comments_desc" class="form-control" id="solvent_neighbor_rating_comments" name="comments" type="text">
</div>
<div class="custom-file form-control mt-2">
<input class="custom-file-input" id="validatedCustomFile_C" name="file" type="file"> <label class="custom-file-label" for="validatedCustomFile_C" id="TGA_C">Upload File (optional; .pdf, .jpg, .png, .tiff; 20 MB max)</label>
<div class="invalid-feedback">
Example invalid custom file feedback
</div>
</div>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="solvent_neighbor_rating_solvname_desc">Solvent evacuated for selected MOF</span>
</div><input aria-describedby="solvent_neighbor_rating_solvname_desc" class="form-control" id="solvent_neighbor_rating_solvname" name="solvent" type="text">
</div><button class="btn btn-primary mt-2" id="submit_C" type="submit">Submit</button>
</form>
</div>
</div>
<div class='col-6 zebra' id='thermal_neighbor_section' style='font-size:22px;'>
Thermal stability ANN nearest neighbors<br>
in latent space <select class='form-control' id='thermal_neighbors' style='font-size:22px;'>
</select>
<div style='width:100%; text-align:center; margin-top:0.5cm;'>
<button class='btn btn-primary round_button' id='t_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Show</button> <button class='btn btn-primary round_button' id='download_t_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Download</button>
</div>
<div style='width:100%; text-align:center;'>
<button class='btn btn-primary round_button' id='visualize_t_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Visualize</button> <button class='btn btn-primary round_button' id='comp_t_neighbor' style='display:inline-block; width:49%; font-size:22px;' type='button'>Get components</button>
</div>
<p class='zebra' id='t_neighbor_info' style='font-size:20px;'></p>
<div id="thermal_neighbor_form">
<form action='/process_feedback' class='col-10' enctype="multipart/form-data" id='thermal_stability_neighbor_feedback' method="post" name="thermal_stability_neighbor_feedback" style='font-size:22px;margin-left:15px'>
<input name="feedback_form_name" type="hidden" value="thermal_stability_neighbor"> <input name="cif_file_name" type="hidden" value=""> <input name="structure" type="hidden" value=""> <i>Rate this existing data: *</i> <input class="rating" data-size="md" id="thermal_neighbor_rating" name="rating" required="" type="text">
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="thermal_neighbor_rating_email_desc">Email (.edu preferred) *</span>
</div><input aria-describedby="thermal_neighbor_rating_email_desc" class="form-control" id="thermal_neighbor_rating_email" name="email" required="" type="email">
</div><select class="form-control mt-2 mb-0" id="inputState_D" name="reason" required="">
<option value="">
Reason for rating... *
</option>
<option>
I've worked with this MOF before, the deposited data is good
</option>
<option>
I've worked with this MOF before, the deposited data is bad (please upload data)
</option>
<option>
The literature contains counter examples of this deposited data (provide DOI of papers with counterexamples in comment field)
</option>
<option>
The paper is incorrect (provide reasoning in comment field)
</option>
<option>
The label obtained from the paper is incorrect (provide reasoning in comment field)
</option>
</select>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="thermal_neighbor_rating_comments_desc">Comments</span>
</div><input aria-describedby="thermal_neighbor_rating_comments_desc" class="form-control" id="thermal_neighbor_rating_comments" name="comments" type="text">
</div>
<div class="custom-file form-control mt-2">
<input class="custom-file-input" id="validatedCustomFile_D" name="file" type="file"> <label class="custom-file-label" for="validatedCustomFile_D" id="TGA_D">Upload File (optional; .pdf, .jpg, .png, .tiff; 20 MB max)</label>
<div class="invalid-feedback">
Example invalid custom file feedback
</div>
</div>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="thermal_neighbor_rating_solvname_desc">Solvent evacuated for selected MOF</span>
</div><input aria-describedby="thermal_neighbor_rating_solvname_desc" class="form-control" id="thermal_neighbor_rating_solvname" name="solvent" type="text">
</div><button class="btn btn-primary mt-2" id="submit_D" type="submit">Submit</button>
</form>
</div>
<div class='col-6' id='tga_plot'></div>
<div class='zebra' id='tga_explanation' style='display: none; margin-top: 0.5cm;'>
<img alt='Explanatory graphic for simplified TGA plots' src='TGA_graphic.png' style='max-width: 120%;'>
<p>In order to generate the simplified TGA plot, four points on the experimental TGA plot are chosen. These points represent two lines of different slope on the TGA plot. The two lines are extrapolated until they intersect, and the point of intersection is taken to be the breakdown temperature.</p>
</div>
</div>
</div>
</div><!-- The Visualization tab of the website -->
<div id="pills-vis">
<!-- MOF viewer and buttons -->
<div class="content inactive" id="viewportwrapper" style="border-style: solid;border-width:2px;">
<!-- MOF visualization -->
<div id="viewportnote" style="position: relative; top: 9em; text-align: center; z-index: 2; font-size: 28px;">
MOF unit cells are visualized here.<br>
Left click to rotate, right click with mouse to move, scroll with mouse to zoom.
</div>
<div id="cifviewport" style="width=100%; height:500px;"></div>
</div>
<div style="margin-bottom:0.5cm;"></div>
<div style='width:100%; text-align:center;'>
<button class='btn btn-primary round_button' id='visualize' style='display:inline-block; width:50%; font-size: 22px' type='button'>Visualize selected (1) MOF</button>
<p class='zebra' style='display:inline-block; width:100%; font-size: 22px'>Special thanks to the Koes and Snurr groups for developing visualization code.</p>
</div>
<div style='width:100%; text-align:center;'>
<div class='zebra' id='currently_visualized' style='display:inline-block; font-size: 22px;'></div>
</div>
<div style='width:100%; text-align:center;'>
<div id='status_visualization' style='display:inline-block; font-size: 22px;'></div>
</div>
</div><!-- The Component Analysis tab of the website -->
<div id="pills-comp">
<div class='row'>
<div class='col-lg-6' style='margin-top: 0.5cm;'>
<div class='mol-container' id='container-01' style='border-style:solid;border-width:2px;background-color: white;'>
<div id='container-01-note' style='position: relative; top: 7em; text-align: center; z-index: 2; font-size: 22px;'>
MOF linkers and SBUs are visualized here.<br>
Left click to rotate, scroll with mouse to zoom.
</div>
</div>
<div style="margin-bottom:0.5cm;"></div>
<div style='width:100%; text-align:center;'>
<button class='btn btn-primary round_button' id='visualize_linker' style='display:inline-block; width:32%; font-size: 22px;' type='button'>Linker</button> <button class='btn btn-primary round_button' id='visualize_sbu' style='display:inline-block; width:32%; font-size: 22px;' type='button'>SBU</button> <button class='btn btn-primary round_button' id='reset_zoom' style='display:inline-block; width:32%; font-size: 22px;' type='button'>Reset zoom</button> <button class='btn btn-primary round_button' id='download_linker' style='display:inline-block; width:49%; font-size: 22px;' type='button'>Download linker</button> <button class='btn btn-primary round_button' id='download_sbu' style='display:inline-block; width:49%; font-size: 22px;' type='button'>Download SBU</button>
</div>
</div>
<div class='col-lg-6' style='margin-top: 0.5cm;'>
<!-- Button for getting MOF components for visualization -->
<div style='width:100%; text-align:center;'>
<button class='btn btn-primary round_button' id='get_components' style='display:inline-block; width:80%; font-size: 22px; margin-bottom: 0.5cm;' type='button'>Get selected (1) MOF components</button>
</div>
<div class='zebra' id='comp_MOF' style='font-size: 22px;'></div><!-- Will display information on what MOF's components are currently visualized -->
<div class='zebra' style='font-size: 22px; margin-top: 0.5cm'>
Linkers <select class='form-control' id='linker' style='font-size: 22px;'>
</select>
</div>
<div class='zebra' style='font-size: 22px;'>
SBUs <select class='form-control' id='sbu' style='font-size: 22px;'>
</select>
</div>
<div style='width:100%; text-align:center; margin-top:0.5cm;'>
<button class='btn btn-primary round_button' id='toggle_unique_components' style='display:inline-block; width:80%; margin-bottom: 0.5cm; font-size: 22px;' type='button'>Filter by connectivity</button>
</div>
<div class='col-12 zebra'>
<p id='component_SMILES' style='margin-top:0.5cm; margin: auto; width:100%; text-align: center; font-size: 22px;'></p>
<p id='resize_hint' style='display: none; margin-top:0.5cm; margin: auto; width:100%; text-align: center; font-style:italic; font-size: 20px;'>Component not visualizing? Try resizing the browser window.</p>
</div>
</div>
</div>
</div><!-- The example MOF selection section of the website -->
<div class='zebra' id="pills-example" style='font-size: 20px;'>
Choose the default MOF HKUST-1 or any CoRE MOF. <!-- Selection box for the example MOF -->
<div class='zebra' style="padding-top: 30px; font-size: 22px;">
Example MOF options <input autocomplete="off" class='form-control locksMetrics' id="MOF_option" list='MOFs_list' onmousedown="value = '';" style='font-size: 22px;'>
</div><!-- Example MOFs -->
<datalist id='MOFs_list' style='font-size: 22px;'>
<!-- Defined near the end of the Javascript section below -->
</datalist>
<div style='width:100%; text-align:center; margin-top:0.5cm;'>
<button class='btn btn-primary round_button' id='select_example' style='display:inline-block; width:49%; font-size: 22px;' type='button'>Select example MOF</button>
</div>
</div><!-- The building block section of the website -->
<div class='zebra' id="pills-bb" style='font-size: 20px;'>
A way for the user to generate MOFs for analysis, using a topological MOF net and nodular and connecting building blocks (bb).<br>
Not every combination of linker, SBU, and net is compatible.<br>
Special thanks to the Gómez-Gualdrón and Snurr groups for developing MOF building block assembly code.<br>
For information on net (topology) abbreviations, refer to 10.1021/acs.cgd.7b00848 and 10.1039/c8ce01637b. <!-- Selection box for the linker building block -->
<div class='zebra' style="padding-top: 30px; font-size: 22px;">
Linker, the connecting building block <input class='form-control locksMetrics' id="linker_option" list='linkers_list' onmousedown="value = '';" style='font-size: 22px;'>
</div><!-- Default linkers -->
<datalist id='linkers_list' style='font-size: 22px;'>
<!-- Defined near the end of the Javascript section below -->
</datalist> <!-- Selection box for metal SBU building block -->
<div class='zebra' style='font-size: 22px;'>
SBU, the metal-centered nodular building block <input class='form-control locksMetrics' id="sbu_option" list='sbus_list' onmousedown="value = '';" style='font-size: 22px;'>
</div><!-- Default sbus -->
<datalist id='sbus_list'>
<!-- Defined near the end of the Javascript section below -->
</datalist>
<div style='font-size: 22px;'>
MOF Net <input class='form-control locksMetrics' id="nets_option" list='nets_list' onmousedown="value = '';" style='font-size: 22px;'>
</div><!-- Default nets -->
<datalist id='nets_list'>
<!-- Defined near the end of the Javascript section below -->
</datalist>
<div style='width:100%; text-align:center; margin-top:0.5cm;'>
<button class='btn btn-primary round_button' id='generate' style='display:inline-block; width:49%; font-size: 22px;' type='button'>Make bb-generated MOF</button> <button class='btn btn-primary round_button' id='download_generated' style='display:inline-block; width:49%; font-size: 22px;' type='button'>Download bb-generated MOF</button>
</div>
</div><!-- The Data Upload tab of the website -->
<div class="container" id="pills-data">
<div class="col-12" id="upload_form">
<form action='/process_feedback' class='col-10' enctype="multipart/form-data" id='upload_form_element' method="post" name="upload_form_element" style='font-size:22px;margin-left:15px'>
<i class='zebra'>Upload information on your MOF!</i> <input name="feedback_form_name" type="hidden" value="upload_form"> <input name="cif_file_name" type="hidden" value=""> <input name="structure" type="hidden" value=""> <input name="rating" type="hidden" value="">
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="upload_form_email_desc">Email (.edu preferred) *</span>
</div><input aria-describedby="upload_form_email_desc" class="form-control" id="upload_form_email" name="email" required="" type="email">
</div>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="upload_form_comments_desc">Comments</span>
</div><input aria-describedby="upload_form_comments_desc" class="form-control" id="upload_form_comments" name="comments" type="text">
</div>
<div class="custom-file form-control mt-2">
<input class="custom-file-input" id="validatedCustomFile_E1" name="cif_file" required="" type="file"> <label class="custom-file-label" for="validatedCustomFile_E1" id="MOF_E">Upload MOF (.cif) *</label>
<div class="invalid-feedback">
Example invalid custom file feedback
</div>
</div>
<div class="custom-file form-control mt-2">
<input class="custom-file-input" id="validatedCustomFile_E2" name="file" required="" type="file"> <label class="custom-file-label" for="validatedCustomFile_E2" id="TGA_E">Upload TGA Trace (.pdf, .jpg, .png, .tiff; 20 MB max) *</label>
<div class="invalid-feedback">
Example invalid custom file feedback
</div>
</div>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="data_upload_solvname_desc">Solvent evacuated from MOF *</span>
</div><input aria-describedby="data_upload_solvname_desc" class="form-control" id="data_upload_solvname" name="solvent" required="" type="text">
</div><button class="btn btn-primary mt-2" id="submit_E" type="submit">Submit</button>
</form>
<form action='/process_removal' class='col-10' enctype="multipart/form-data" id='removal_form_element' method="post" name="removal_form_element" style='font-size:22px;margin-left:15px'>
<i class='zebra'>Request information removal from our databases</i>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="removal_form_email_desc">Email (.edu preferred) *</span>
</div><input aria-describedby="removal_form_email_desc" class="form-control" id="removal_form_email" name="email" required="" type="email">
</div>
<div class="input-group mt-2" style="">
<div class="input-group-prepend">
<span class="input-group-text" id="removal_form_comments_desc">Describe entry to remove (date uploaded, type of MOF, etc) *</span>
</div><input aria-describedby="removal_form_comments_desc" class="form-control" id="removal_form_comments" name="comments" required="" type="text">
</div><button class="btn btn-primary mt-2" id="submit_F" type="submit">Submit</button>
</form>
</div>
</div>
</div>
<div class="navbar navbar-expand-lg relative navbar-dark bg-primary" style="margin-top: 50px; font-size: 24px;">
<div class="container">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link disabled">Site developed and maintained by the Kulik Group at MIT<br>
Contact: mofsimplify@mit.edu</a>
</li>
</ul>
</div>
</div><!-- For cif file upload -->
<form>
<input id="file_input" name="file_input" style="display:none" type="file"> <!-- This will never display anything. Just used to store a MOF cif file if the button "Custom (upload cif file)" is used. -->
<!-- For example MOF file -->
</form>
<p id="example_holder"></p><!-- This will never display anything. Just used to store a MOF cif file if the button "Example MOF" is used. -->
<!-- For building block-generated MOF file -->
<p id="bbg_MOF_holder"></p><!-- This will never display anything. Just used to store a MOF if the button "Make bb-generated MOF" is used. -->
<!-- For MOF components (xyz file text) -->
<p id="components_holder"></p><!-- This will never display anything. Just used to store components if the button "Get selected (1) MOF components" is used. -->
<!-- For solvent removal stability ANN nearest neighbors -->
<p id="solvent_neighbors_holder"></p><!-- This will never display anything. Just used to store ANN nearest neighbors if the button "Stability upon solvent removal" is used. -->
<!-- For thermal stability ANN nearest neighbors -->
<p id="thermal_neighbors_holder"></p><!-- This will never display anything. Just used to store ANN nearest neighbors if the button "Thermal stability" is used. -->
<!-- Beginning of JavaScript section -->
<script>
// Lots of this code is from sbu.html at https://github.com/snurr-group/web-mofid, for MOF visualization.
// ***** Beginning of section with a lot of copied code from the Snurr group's GitHub. *****
// With some modifications for our purposes, specifically in the handleInput function. Also, the OOM message.
var stage;
// Variables below: used for MOF visualization re-tries if OOM error appears
var vis_error_counter = 0;
var vis_failure = false;
var MAX_VIS_ERROR = 3; // maximum number of times a MOF can fail to be visualized before error message is displayed
var solvent_neighbor_vis = false
var thermal_neighbor_vis = false
//
var lsdir = function (path) {
return FS.readdir(path).filter(function (e) {
return !['..', '.'].includes(e); // filter out current and parent dirs
}).sort();
};
// Adapted from examples at http://nglviewer.org/ngl/api/manual/usage/embedding.html
// and https://codepen.io/pen?template=JNLMXb and http://nglviewer.org/ngldev/api/manual/snippets.html
document.addEventListener("DOMContentLoaded", function () {
stage = new NGL.Stage("cifviewport");
stage.setParameters({ backgroundColor: "white" });
});
var runMOFidCode = function (cifdata) {
C_obcode = Module.cwrap(
'analyzeMOFc', 'null', ['string', 'number', 'number']
);
if (!FS.analyzePath('/Output').exists) {
FS.mkdir('/Output'); // See also docs on filesystem API: https://kripken.github.io/emscripten-site/docs/api_reference/Filesystem-API.html
// Ideally, the C_obcode executable would automatically make all of the directories,
// but it's broken at least in an old version of Emscripten.
FS.mkdir('/Output/MetalOxo');
FS.mkdir('/Output/SingleNode');
FS.mkdir('/Output/AllNode');
FS.mkdir('/Output/StandardIsolated');
}
var buflen = 65536;
var ptr = Module._malloc(buflen);
var buffer = new Uint8Array(Module.HEAPU8.buffer, ptr, buflen); // Get a bytes view on the newly allocated buffer.
C_obcode(cifdata, ptr, buflen);
var ans = Module.UTF8ToString(ptr);
Module._free(ptr);
return ans;
};
var analyzeMOF = function (input_cif_str, cif_name) {
// Get relevant MOFid/MOFkey information from an input string of CIF-formatted coordinates
var raw_mofid_output = runMOFidCode(input_cif_str);
var single_node_topology = getTopology("/Output/SingleNode/topology.cgd");
var all_node_topology = getTopology("/Output/AllNode/topology.cgd");
// Extract the MOFid, per run_mofid.py:cif2mofid
const fragment_info = _extractFragments(raw_mofid_output);
let mofid_topology = '';
if (fragment_info.cat == null) {
mofid_topology = 'NA'
} else if (single_node_topology == all_node_topology) {
mofid_topology = single_node_topology;
} else {
mofid_topology = single_node_topology + ',' + all_node_topology;
}
let mof_name = cif_name;
if (cif_name.endsWith('.cif') || cif_name.endsWith('.CIF')) {
mof_name = cif_name.substring(0, cif_name.length - 4);
}
const all_fragments = fragment_info.nodes.concat(fragment_info.linkers);
all_fragments.sort();
// Assembling the MOFid from id_constructor.py:assemble_mofid
let mofid = all_fragments.join('.');
mofid += ' MOFid-v1.';
mofid += mofid_topology + '.';
if (fragment_info.cat == 'no_mof') {
mofid += fragment_info.cat
} else if (fragment_info.cat != null) {
mofid += 'cat' + fragment_info.cat;
} else {
mofid += 'NA';
}
if (mofid.startsWith(' ')) { // Null linkers. Make .smi compatible
mofid = '*' + mofid + 'no_mof';
}
mofid += ';' + mof_name;
// Extract the MOFkey
var base_mofkey = "";
if (fragment_info.parsed) {
base_mofkey = FS.readFile("/Output/MetalOxo/mofkey_no_topology.txt", { 'encoding': 'utf8' });
}
var mofkey = base_mofkey.replace('MOFkey-v1', 'MOFkey-v1.' + single_node_topology);
return {
raw_output: raw_mofid_output,
mofid: mofid,
mofkey: mofkey,
fragments: fragment_info
};
}
var _extractFragments = function (raw_mofid_output) {
// Parse the MOFid output, per id_constructor.py:extract_fragments
let all_fragments = raw_mofid_output.trim().split(/\r\n|\r|\n/g);
all_fragments = all_fragments.map(a => a.trim());
if (all_fragments == '') {
return { nodes: ['*'], linkers: [], cat: cat, parsed: false };
}
const cat_num_line = all_fragments.pop();
let cat = null;
if (cat_num_line.includes('simplified net(s)')) {
cat = (parseInt(cat_num_line[8]) - 1).toString(); // '# Found x simplified net(s)'
if (cat == '-1') {
cat = null;
}
} else {
all_fragments = ['*'];
}
// Parse node/linker fragment notation
if (all_fragments[0] != '# Nodes:') {
return { nodes: ['*'], linkers: [], cat: cat, parsed: false };
}
all_fragments.shift();
const linker_flag_loc = all_fragments.findIndex(line => (line == "# Linkers:"));
const node_fragments = all_fragments.slice(0, linker_flag_loc);
const linker_fragments = all_fragments.slice(linker_flag_loc + 1);
node_fragments.sort();
linker_fragments.sort();
return { nodes: node_fragments, linkers: linker_fragments, cat: cat, parsed: true };
}
var rawToSmiles = function (raw_mofid) {
// Converts the raw output from the MOFid code to a parseable SMILES format
var lines = raw_mofid.replace(/\t/g, '').split(/\r\n|\r|\n/g); // remove trailing tabs before splitting
lines.pop(); // remove line about number of simplified nets
return lines.join('.');
}
handleInput = function (s_neighbor, t_neighbor) {
// s_neighbor and t_neighbor are booleans, indicate if we are visualizing a neighbor
// if not, default to visualize the MOF that is queued up
if (s_neighbor) { // In this case, want to visualize the solvent removal stability ANN neighbor
// grab the current solvent neighbor MOF cif file
my_neighbor = $('#solvent_neighbors').val(); // select the solvent removal stability ANN nearest neighbor selected in the dropdown
my_neighbor = my_neighbor.substring(3) // hack off the list-y number part
fetch('CoRE2019/' + my_neighbor + '.cif').then(response => { // grabbing the MOF from local host
if (!response.ok) { // catching 404 and other issues
throw Error(response.statusText);
}
return response.blob();
}).then(function (blob) {
var ciffile = new File([blob], "solvent_neighbor.cif", { type: "", lastModified: Date.now() }) // making a cif file
handleVisualization(ciffile)
}).catch(error => {
console.error('There has been a problem with your fetch operation:', error);
})
}
else if (t_neighbor) { // In this case, want to visualize the thermal stability ANN neighbor
// grab the current solvent neighbor MOF cif file
my_neighbor = $('#thermal_neighbors').val(); // select the thermal stability ANN nearest neighbor selected in the dropdown
my_neighbor = my_neighbor.substring(3) // hack off the list-y number part
fetch('CoRE2019/' + my_neighbor + '.cif').then(response => { // grabbing the MOF from local host
if (!response.ok) { // catching 404 and other issues
throw Error(response.statusText);
}
return response.blob();
}).then(function (blob) {
var ciffile = new File([blob], "thermal_neighbor.cif", { type: "", lastModified: Date.now() }) // making a cif file
handleVisualization(ciffile)
}).catch(error => {
console.error('There has been a problem with your fetch operation:', error);
})
}
else { // Visualize the queued up MOF (either the default MOF, the uploaded MOF, or the building block MOF)
// Code elsewhere in this file makes it so only one of the three will be available, if any of them are available
if (document.getElementById("file_input").files[0] !== undefined) {
var ciffile = document.getElementById("file_input").files[0];
}
else if (document.getElementById("example_holder").value !== null) {
var ciffile = document.getElementById("example_holder").value;
}
else {
var ciffile = document.getElementById('bbg_MOF_holder').value;
}
}
handleVisualization(ciffile)
}
handleVisualization = function (ciffile) {
var cifreader = new FileReader();
cifreader.onload = function (event) {
var mofid_results = analyzeMOF(event.target.result, ciffile.name);
if (mofid_results.fragments.parsed) {
const mofid_html = "<div>MOFid:<br /><code>" + mofid_results.mofid + "<\/code><\/div>";
const mofkey_html = "<div>MOFkey:<br /><code>" + mofid_results.mofkey + "<\/code><\/div>";
updateFileLists(); // populate the initial list of files
document.getElementById("viewportnote").style.display = "none";
document.getElementById("viewportwrapper").classList.remove("inactive");
clearViewer(stage);
drawEmPDB(stage, "/Output/orig_mol.pdb");
} else {
document.getElementById("viewportwrapper").classList.add("inactive");
}
};
// The below try-catch fixes a Chrome issue for visualizing neighbors (Uncaught TypeError: Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'.)
try {
cifreader.readAsText(ciffile);
}
catch (e) {
}
}
getTopology = function (path_to_cgd) {
// Extract topology from a generated CGD simplified net
const raw_rcsr_extract = FS.readFile("/RCSRnets.arc", { 'encoding': 'utf8' });
const raw_cgd = FS.readFile(path_to_cgd, { 'encoding': 'utf8' });
if (!raw_cgd.includes('NODE')) {
return "ERROR"; // not a MOF: no node building blocks found!
} else {
return webGavrog.getRawRCSRTopology(raw_cgd, raw_rcsr_extract);
}
}
updateFileLists = function () {
//clearDropdown("cifdownload");
var folder_name = "";//getInputValue("folderdownload");
var selected_view_index = "none";//document.getElementById("view_type").selectedIndex;
var filelist;
var view_value_list = ["original", "nodes_and_linkers", "simplified_net"];
var view_name_list = ["Original MOF", "Nodes + Linkers", "Simplified topology"];
if (folder_name == "") { // original base directory
filelist = ["orig_mol.cif", "orig_mol.pdb"];
// Only keeping the original MOF in the viewer types:
view_value_list = [view_value_list[0]];
view_name_list = [view_name_list[0]];
selected_view_index = "0";
} else {
filelist = lsdir("/Output/" + folder_name);
// Removing the original MOF from the viewer types:
view_value_list.shift();
view_name_list.shift();
}
if (folder_name == "AllNode") {
// Separate linkers into branches + branch points for the AllNode algorithm
view_value_list[0] = "nodes_and_branches";
}
}
clearViewer = function (ngl_stage) {
ngl_stage.removeAllComponents();
}
addPDBtoViewer = function (ngl_stage, path_to_cif, color_scheme = "element") {
var component;
ngl_stage.loadFile(path_to_cif, { ext: "pdb" }).then(function (o) {
o.addRepresentation("ball+stick", { colorScheme: color_scheme });
o.addRepresentation("unitcell");
o.autoView();
/* See class documentation at http://nglviewer.org/ngl/api/class/src/stage/stage.js~Stage.html */
/* See also the general documentation at http://nglviewer.org/ngl/api/manual/ */
});
return component;
}
drawEmPDB = function (ngl_stage, emscripten_path, color_scheme = "element") {
var cif_string = FS.readFile(emscripten_path, { 'encoding': 'utf8' });
var temp_file = new Blob([cif_string], { type: 'chemical/x-cif' });
return addPDBtoViewer(ngl_stage, temp_file, color_scheme);
}
var Module = {
preRun: [],
postRun: [],
print: (function () {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function (text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})(),
printErr: function (text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
},
canvas: (function () {
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
return null;
})(),
setStatus: function (text) {
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
if (text === Module.setStatus.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var now = Date.now();
if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon
if (m) {
text = m[1];
}
},
totalDependencies: 0,
monitorRunDependencies: function (left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies - left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
// If the user chooses to try to visualize a MOF (either the selected MOF or a neighbor MOF), visualization is attempted by the website three times
// This is because OOM errors are sometimes thrown upon visualization, but upon retrying, visualization often succeeds
// A cap of three is used because some MOFs will always fail visualization (if their unit cell from the cif is too large, or this code just doesn't like them)
// After three failed tries, an error alert is shown to the user
window.onerror = function (event) {
if (vis_error_counter == MAX_VIS_ERROR) {
//Module.setStatus('Exception thrown in visualization; please retry the operation.');
document.getElementById("viewportnote").innerHTML = "Visualization failed";
alert('MOF cannot be visualized.') // out of memory (OOM). Exception thrown in visualization
// $('#status_visualization').text('Exception thrown in visualization; please retry the operation.');
$('#currently_visualized').text(''); // clear the message about which MOF is visualized if OOM occurs
// visualize_color = failure_red;
// $('#visualize').css({'background-color': failure_red, 'border-color': failure_red}); // setting button color to indicate failure
Module.setStatus = function (text) {
if (text) Module.printErr('[post-exception status] ' + text);
};
}
else {
vis_error_counter += 1
vis_failure = true
handleInput(solvent_neighbor_vis, thermal_neighbor_vis); // handles visualization, will display the MOF in the appropriate box (viewportwrapper)
}
};
// ***** End of section with a lot of copied code. *****
// tags for changing the selection button colors, depending on if an operation is successfully completed or not
failure_red = '#A33B20';
success_green = '#18bc9c';
inprogress_yellow = '#F7B801'
original_blue = '#2c3e50';
load_color = original_blue;
upload_color = original_blue;
bb_redirect_color = original_blue;
solvent_pred_color = original_blue;
thermal_pred_color = original_blue;
visualize_color = original_blue
component_color = original_blue
$(function () {
// Set up 3Dmol viewer
let element = $('#container-01');