-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsane-jan2023.py
1716 lines (1457 loc) · 82 KB
/
insane-jan2023.py
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
#!/usr/bin/env python
# Modified by Cyril Schroeder and Dheeraj Prakaash: 12 Jan 2023
# added Martini3 CDL2 (named CDL) and defined in martini_v3_CDL.itp
# based on published parameters by Corey et al, Sci Adv 2021. https://doi.org/10.1126%2Fsciadv.abh2217
#--------------------------------------------
# Modified by Dheeraj Prakaash : 19 Nov 2020
# added LPS (RAMP,REMP,OANT) and defined in martini_v2.0_lipids_all_201506_LPS.itp
#--------------------------------------------
# Modified by Jonathan Machin and Dheeraj Prakaash: Oct 2020
# added DLPG
#--------------------------------------------
# Modified by D.DeVecchis 20th-Oct-2017
# update the script with the new beads definition in "martini_v2.0_lipids_all_201506.itp"
#
# old new
# POPS CN0 -> POPS CNO
# POP2 CP -> POP2 PO4
# POP2 C2A -> POP2 D2A
# POP2 D3A -> POP2 C3A
# POP3 CP -> POP2 PO4
# POP3 C2A -> POP2 D2A
# POP3 D3A -> POP2 C3A
#--------------------------------------------
import sys,math,random
version = "---"
previous = "20140603.11.TAW"
# Modify insane to take in arbitary lipid definition strings and use them as a template for lipids
# Also take in lipid name
# Edits: by Helgi I. Ingolfsson (all edits are marked with: # HII edit - lipid definition )
# PROTOLIPID (diacylglycerol), 18 beads
#
# 1-3-4-6-7--9-10-11-12-13-14
# \| |/ |
# 2 5 8-15-16-17-18-19-20
#
lipidsx = {}
lipidsy = {}
lipidsz = {}
lipidsa = {}
#
## Diacyl glycerols
moltype = "lipid"
lipidsx[moltype] = ( 0, .5, 0, 0, .5, 0, 0, .5, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
lipidsy[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsz[moltype] = ( 10, 9, 9, 8, 8, 7, 6, 6, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0)
lipidsa.update({ # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
## Phospholipids
"DTPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A - - - - C1B C2B - - - - "),
"DLPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - "),
"DPPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B C2B C3B C4B - - "),
"DBPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - "),
"POPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - "),
"DOPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B D2B C3B C4B - - "),
"DAPC": (moltype, " - - - NC3 - PO4 GL1 GL2 D1A D2A D3A D4A C5A - D1B D2B D3B D4B C5B - "),
"DIPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A D2A D3A C4A - - C1B D2B D3B C4B - - "),
"DGPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A D3A C4A C5A - C1B C2B D3B C4B C5B - "),
"DNPC": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A D4A C5A C6A C1B C2B C3B D4B C5B C6B"),
"DTPE": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A - - - - C1B C2B - - - - "),
"DLPE": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - "),
"DPPE": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B C2B C3B C4B - - "),
"DBPE": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - "),
"POPE": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - "),
"DOPE": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B D2B C3B C4B - - "),
"POPG": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - "),
"DLPG": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - "),
"DOPG": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B D2B C3B C4B - - "),
"POPS": (moltype, " - - - CNO - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - "),
"DOPS": (moltype, " - - - CN0 - PO4 GL1 GL2 C1A D2A C3A C4A - - C1B D2B C3B C4B - - "),
"DPSM": (moltype, " - - - NC3 - PO4 AM1 AM2 T1A C2A C3A - - - C1B C2B C3B C4B - - "),
"DBSM": (moltype, " - - - NC3 - PO4 AM1 AM2 T1A C2A C3A C4A - - C1B C2B C3B C4B C5B - "),
"BNSM": (moltype, " - - - NC3 - PO4 AM1 AM2 T1A C2A C3A C4A - - C1B C2B C3B C4B C5B C6B"),
# PG for thylakoid membrane
"OPPG": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B D2B C3B C4B - - "),
# PG for thylakoid membrane of spinach (PPT with a trans-unsaturated bond at sn1 and a triple-unsaturated bond at sn2,
# and PPG with a transunsaturated bond at sn1 and a palmitoyl tail at sn2)
"JPPG": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A C3A C4A - - D1B C2B C3B C4B - - "),
"JFPG": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A D2A D3A D4A - - D1B C2B C3B C4B - - "),
## Monoacylglycerol
"GMO": (moltype, " - - - - - - GL1 GL2 C1A C2A D3A C4A C5A - - - - - - - "),
## Templates using the old lipid names and definitions
"DHPC.o": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A - - - - C1B C2B - - - - "),
"DMPC.o": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - "),
"DSPC.o": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - "),
"POPC.o": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B C2B D3B C4B C5B - "),
"DOPC.o": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A D3A C4A C5A - C1B C2B D3B C4B C5B - "),
"DUPC.o": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A D2A D3A C4A - - C1B D2B D3B C4B - - "),
"DEPC.o": (moltype, " - - - NC3 - PO4 GL1 GL2 C1A C2A C3A D4A C5A C6A C1B C2B C3B D4B C5B C6B"),
"DHPE.o": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A - - - - C1B C2B - - - - "),
"DLPE.o": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - "),
"DMPE.o": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - "),
"DSPE.o": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - "),
"POPE.o": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B C2B D3B C4B C5B - "),
"DOPE.o": (moltype, " - - - NH3 - PO4 GL1 GL2 C1A C2A D3A C4A C5A - C1B C2B D3B C4B C5B - "),
"PPCS.o": (moltype, " - - - NC3 - PO4 AM1 AM2 C1A C2A C3A C4A - - D1B C2B C3B C4B - - "),
# "DLPG.o": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - "),
"DOPG.o": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A D3A C4A C5A - C1B C2B D3B C4B C5B - "),
"POPG.o": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B C2B D3B C4B C5B - "),
"DOPS.o": (moltype, " - - - CN0 - PO4 GL1 GL2 C1A C2A D3A C4A C5A - C1B C2B D3B C4B C5B - "),
"POPS.o": (moltype, " - - - CNO - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B C2B D3B C4B C5B - "),
"CPG.o": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A C3A C4A - - C1B C2B D3B C4B - - "),
"PPG.o": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A C2A C3A C4A - - D1B C2B C3B C4B - - "),
"PPT.o": (moltype, " - - - GL0 - PO4 GL1 GL2 C1A D2A D3A D4A - - D1B C2B C3B C4B - - "),
"DSMG.o": (moltype, " - - - C6 C4 C1 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - "),
"DSDG.o": (moltype, "C61 C41 C11 C62 C42 C12 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - "),
"DSSQ.o": (moltype, " - - S6 C6 C4 C1 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - "),
})
# HII fix for PI templates and new templates PI(s) with diffrent tails, PO-PIP1(3) and POPIP2(4,5)
#Prototopology for phosphatidylinositol type lipids 5,6,7 are potentail phosphates (PIP1,PIP2 and PIP3)
# 1,2,3 - is the inositol and 4 is the phosphate that links to the tail part.
# 5
# \
# 6-2-1-4-8--10-11-12-13-14-15
# |/ |
# 7-3 9--16-17-18-19-20-21
moltype = "INOSITOLLIPIDS"
lipidsx[moltype] = ( .5, .5, 0, 0, 1, .5, 0, 0, .5, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
lipidsy[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsz[moltype] = ( 8, 9, 9, 7, 10, 10, 10, 6, 6, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0)
lipidsa.update({ # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
"DPPI": (moltype, " C1 C2 C3 CP - - - GL1 GL2 C1A C2A C3A C4A - - C1B C2B C3B C4B - - "),
"POPI": (moltype, " C1 C2 C3 CP - - - GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - "),
"PIPI": (moltype, " C1 C2 C3 CP - - - GL1 GL2 C1A D2A D3A C4A - - C1B C2B C3B C4B - - "),
"PAPI": (moltype, " C1 C2 C3 CP - - - GL1 GL2 D1A D2A D3A D4A C5A - C1B C2B C3B C4B - - "),
"PUPI": (moltype, " C1 C2 C3 CP - - - GL1 GL2 D1A D2A D3A D4A D5A - C1B C2B C3B C4B - - "),
"POP1": (moltype, " C1 C2 C3 CP P1 - - GL1 GL2 C1A C2A D3A C4A - - C1B C2B C3B C4B - - "),
"POP2": (moltype, " C1 C2 C3 PO4 P1 P2 - GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - "),
"POP3": (moltype, " C1 C2 C3 PO4 P1 P2 P3 GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - "),
## Templates using the old lipid names and definitions
"PI.o" : (moltype, " C1 C2 C3 CP - - - GL1 GL2 C1A C2A C3A C4A - - CU1 CU2 CU3 CU4 CU5 - "),
"PI34.o": (moltype, " C1 C2 C3 CP PO1 PO2 - GL1 GL2 C1A C2A C3A C4A - - CU1 CU2 CU3 CU4 CU5 - "),
})
#Prototopology for longer and branched glycosil and ceramide based glycolipids
#
# 17-15-14-16
# |/
# 13
# |
# 12-10-9-7-6-4-3-1--18--20-21-22-23-24
# |/ |/ |/ |/ |
# 11 8 5 2 19--25-26-27-28-29
moltype = "GLYCOLIPIDS"
lipidsx[moltype] = ( 0, .5, 0, 0, .5, 0, 0, .5, 0, 0, .5, 0, 0, 0, 0, 0, 0, 0, .5, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
lipidsy[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsz[moltype] = ( 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 13, 13, 10, 9, 10, 8, 11, 5, 5, 4, 3, 2, 1, 0, 4, 3, 2, 1, 0)
lipidsa.update({ # 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
"DPG1": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 GM7 GM8 GM9 GM10 GM11 GM12 GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A - - - C1B C2B C3B C4B - - "),
"DXG1": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 GM7 GM8 GM9 GM10 GM11 GM12 GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B C6B"),
"PNG1": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 GM7 GM8 GM9 GM10 GM11 GM12 GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A - - - C1B C2B C3B D4B C5B C6B"),
"XNG1": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 GM7 GM8 GM9 GM10 GM11 GM12 GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A C4A C5A - C1B C2B C3B D4B C5B C6B"),
"DPG3": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 - - - - - - GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A - - - C1B C2B C3B C4B - - "),
"DXG3": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 - - - - - - GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B C6B"),
"PNG3": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 - - - - - - GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A - - - C1B C2B C3B D4B C5B C6B"),
"XNG3": (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 - - - - - - GM13 GM14 GM15 GM16 GM17 AM1 AM2 T1A C2A C3A C4A C5A - C1B C2B C3B D4B C5B C6B"),
"DPCE": (moltype, " - - - - - - - - - - - - - - - - - AM1 AM2 T1A C2A C3A - - C1B C2B C3B C4B - "),
"DPGS": (moltype, " C1 C2 C3 - - - - - - - - - - - - - - AM1 AM2 T1A C2A C3A - - C1B C2B C3B C4B - "),
"DPMG": (moltype, " C1 C2 C3 - - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
"DPSG": (moltype, " S1 C1 C2 C3 - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
"DPGG": (moltype, "GB2 GB3 GB1 GA1 GA2 GA3 - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
#lipids for thylakoid membrane of cyanobacteria: oleoyl tail at sn1 and palmiotyl chain at sn2. SQDG no double bonds
"OPMG": (moltype, " C1 C2 C3 - - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B D2B C3B C4B - "),
"OPSG": (moltype, " S1 C1 C2 C3 - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B D2B C3B C4B - "),
"OPGG": (moltype, "GB2 GB3 GB1 GA1 GA2 GA3 - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B D2B C3B C4B - "),
#lipids for thylakoid membrane of spinach: for the *T both chains are triple unsaturated and the *G have a triple unsaturated chain at sn1 and a palmitoyl chain at sn2.
"FPMG": (moltype, " C1 C2 C3 - - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B D2B D3B D4B - "),
"DFMG": (moltype, " C1 C2 C3 - - - - - - - - - - - - - - GL1 GL2 C1A D2A D3A D4A - C1B D2B D3B D4B - "),
"FPSG": (moltype, " S1 C1 C2 C3 - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B D2B D3B D4B - "),
"FPGG": (moltype, "GB2 GB3 GB1 GA1 GA2 GA3 - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B D2B D3B D4B - "),
"DFGG": (moltype, "GB2 GB3 GB1 GA1 GA2 GA3 - - - - - - - - - - - GL1 GL2 C1A D2A D3A D4A - C1B D2B D3B D4B - "),
## Templates using the old lipid names and definitions
"GM1.o" : (moltype, "GM1 GM2 GM3 GM4 GM5 GM6 GM7 GM8 GM9 GM10 GM11 GM12 GM13 GM14 GM15 GM16 GM17 AM1 AM2 C1A C2A C3A C4A C5A C1B C2B C3B C4B - "),
"DGDG.o": (moltype, "GB2 GB3 GB1 GA1 GA2 GA3 - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
"MGDG.o": (moltype, " C1 C2 C3 - - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
"SQDG.o": (moltype, " S1 C1 C2 C3 - - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
"CER.o" : (moltype, " - - - - - - - - - - - - - - - - - AM1 AM2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
"GCER.o": (moltype, " C1 C2 C3 - - - - - - - - - - - - - - AM1 AM2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
"DPPI.o": (moltype, " C1 C2 C3 - CP - - - - - - - - - - - - GL1 GL2 C1A C2A C3A C4A - C1B C2B C3B C4B - "),
})
moltype = "QUINONES"
lipidsx[moltype] = ( 0, .5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsy[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsz[moltype] = ( 6, 7, 7, 5.5, 5, 4.5, 4, 3.5, 2.5, 2, 1.5, 1)
lipidsa.update({ # 1 2 3 4 5 6 7 8 9 10 11 12
"PLQ": (moltype, " PLQ3 PLQ2 PLQ1 PLQ4 PLQ5 PLQ6 PLQ7 PLQ8 PLQ9 PLQ10 PLQ11 PLQ12"),
})
# Prototopology for cardiolipins
#
# 4-11-12-13-14-15-16
# |
# 2---3--5--6--7--8--9-10
# /
# 1
# \
# 17-18-20-21-22-23-24-25
# |
# 19-26-27-28-29-30-31
#
moltype = "CARDIOLIPINS"
lipidsx[moltype] = ( 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
lipidsy[moltype] = ( 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
lipidsz[moltype] = ( 8, 7, 6, 6, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0, 7, 6, 6, 5, 4, 3, 2, 1, 0, 5, 4, 3, 2, 1, 0)
lipidsa.update({ # 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
"CDL0": (moltype, "GL0 PO41 GL11 GL21 C1A1 C2A1 D3A1 C4A1 C5A1 - C1B1 C2B1 D3B1 C4B1 C5B1 - PO42 GL21 GL22 C1A2 C2A2 D3A2 C4A2 C5A2 - C1B2 C2B2 D3B2 C4B2 C5B2 -"), # updated names as per Martini 2.2 ITP
"CDL1": (moltype, "GL0 PO41 GL11 GL21 C1A1 C2A1 D3A1 C4A1 C5A1 - C1B1 C2B1 D3B1 C4B1 C5B1 - PO42 GL21 GL22 C1A2 C2A2 D3A2 C4A2 C5A2 - C1B2 C2B2 D3B2 C4B2 C5B2 -"), # updated names as per Martini 2.2 ITP
"CDL2": (moltype, "GL0 PO41 GL11 GL21 C1A1 C2A1 D3A1 C4A1 C5A1 - C1B1 C2B1 D3B1 C4B1 C5B1 - PO42 GL12 GL22 C1A2 C2A2 D3A2 C4A2 C5A2 - C1B2 C2B2 D3B2 C4B2 C5B2 -"), # updated names as per Martini 2.2 ITP
# edit
"CDL": (moltype, "GL0 PO1 GL1 GL2 C1A D2A C3A C4A - - C1B C2B C3B C4B - - PO2 GL3 GL4 C1C D2C C3C C4C - - C1D C2D C3D C4D - -"), # updated names as per Martini 3 ITP from https://www.science.org/doi/10.1126/sciadv.abh2217
"CL4P": (moltype, "GL5 PO41 GL1 GL2 C1A C2A C3A C4A C5A - C1B C2B C3B C4B C5B - PO42 GL3 GL4 C1C C2C C3C C4C C5C - C1D C2D C3D C4D C5D -"),
"CL4M": (moltype, "GL5 PO41 GL1 GL2 C1A C2A C3A - - - C1B C2B C3B - - - PO42 GL3 GL4 C1C C2C C3C - - - C1D C2D C3D - - -"),
## Templates using the old lipid names and definitions
"CL4.o" : (moltype, "GL5 PO41 GL1 GL2 C1A C2A D3A C4A C5A - C1B C2B D3B C4B C5B - PO42 GL3 GL4 C1C C2C D3C C4C C5C - C1D C2D D3D C4D C5D -"),
"CL4O.o": (moltype, "GL5 PO41 GL1 GL2 C1A C2A D3A C4A C5A - C1B C2B D3B C4B C5B - PO42 GL3 GL4 C1C C2C D3C C4C C5C - C1D C2D D3D C4D C5D -"),
})
# Prototopology for mycolic acid(s)
#
# 1--2--3--4--5--6--7--8
# |
# 16-15-14-13-12-11-10--9
# |
# 17-18-19-20-21-22-23-24
# /
# 32-31-30-29-28-27-25-26
#
moltype = "MYCOLIC ACIDS"
lipidsx[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
lipidsy[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsz[moltype] = ( 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 1, 0, 2, 3, 4, 5, 6, 7)
lipidsa.update({ # 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
"AMA": (moltype, " - - - C1A C2A C3A C4A C5A M1A C1B C2B C3B C4B - - - - - M1B C1C C2C C3C - - COH OOH C1D C2D C3D C4D C5D C6D"),
"AMA.w": (moltype, " - - - C1A C2A C3A C4A C5A M1A C1B C2B C3B C4B - - - - - M1B C1C C2C C3C - - COH OOH C1D C2D C3D C4D C5D C6D"),
"KMA": (moltype, " - - - C1A C2A C3A C4A C5A M1A C1B C2B C3B C4B - - - - - M1B C1C C2C C3C - - COH OOH C1D C2D C3D C4D C5D C6D"),
"MMA": (moltype, " - - - C1A C2A C3A C4A C5A M1A C1B C2B C3B C4B - - - - - M1B C1C C2C C3C - - COH OOH C1D C2D C3D C4D C5D C6D"),
})
# Sterols
moltype = "sterol"
lipidsx[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0)
lipidsy[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsz[moltype] = ( 0, 0, 0, 0, 0, 0, 5.3,4.5,3.9,3.3, 3 ,2.6,1.4, 0, 0, 0, 0, 0)
lipidsa.update({
"CHOL": (moltype, " - - - - - - ROH R1 R2 R3 R4 R5 C1 C2 - - - - "),
"ERGO": (moltype, " - - - - - - ROH R1 R2 R3 R4 R5 C1 C2 - - - - "),
})
# Hopanoids
moltype = "Hopanoids"
lipidsx[moltype] = ( 0, 0, 0, 0, 0.5,-0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsy[moltype] = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
lipidsz[moltype] = ( 0, 0, 0, 0, 0.5, 1.4, 2.6, 3, 3.3, 3.9, 4.5, 5.0, 5.5, 6.0, 0, 0, 0, 0)
lipidsa.update({
"HOPR": (moltype, " - - - R1 R2 R3 R4 R5 R6 R7 R8 - - - - - - - "),
"HHOP": (moltype, " - - - R1 R2 R3 R4 R5 R6 R7 R8 C1 - - - - - - "),
"HDPT": (moltype, " - - - R1 R2 R3 R4 R5 R6 R7 R8 C1 - - - - - - "),
"HBHT": (moltype, " - - - R1 R2 R3 R4 R5 R6 R7 R8 C1 C2 C3 - - - - "),
})
# Prototopology for LPS obtained from DOI:10.1016/j.jmgm.2015.12.002
# Added to Insane on 30.Oct.2020 - DheerajPrakaash
# Updated 19.Nov.2020
#
# PO4 ______
# | /
# 0GB--2hA--6GA--3H1 PO4 0KO XYA-LP1______
# | \ / / / _______
# 0GA--6GB--WLL PO4-PH2--LKO--SYB--LP1_______
# / / \
# PO4 PO4 LP2-------
#
#
# 3 forms of LPS lipids derived from ChGUI: RAMP,REMP,OANT.
# Coordinates/Topologies of each obtained from ChGUI Martini Maker & added to martini_v2.0_lipids_all_201506_LPS.itp
#
# Atoms of RAMP,REMP are a subset of OANT atoms.
# Thus, only OANT co-ordinates are used below (obtained from ChGUI Martini Maker and energy-minimized in vacuum).
moltype = "Lipopolysaccharide"
lipidsx[moltype] = ( 2.99, 2.93, 3.08, 2.88, 1.4, 1.59, 1.53, 0.05, 2.96, 2.24, 1.98, 1.36, 1.68, 2.84, 2.41, 2.21, 3.9, 3.59, 3.69, 3.81, 3.82, 4.56, 4.06, 3.11, 1.02, 0.97, 0, 0.01, 1.94, 2.03, 2.39, 3.04, 3.9, 3.18, 2.47, 2.52, 2.21, 1.35, 1.29, 1.92, 2.7, 0.89, 2.6, 1.94, 2.64, 1.29, 3.07, 2.61, 2.1, 2.7, 3.36, 1.26, 0.78, 1.98, 1.17, 2.54, 2.2, 2.93, 2.22, 2.65, 3.61, 3.02, 2.07, 1.37, 2.07, 2.5, 2.9, 2.65, 1.51, 1, 0.96, 1.07, 0.75, 1.21, 2.55, 2.65, 2.4, 3.07, 3.97, 3.54, 2.64, 2.48, 1.67, 2.49, 2.12, 2.63, 2.69, 2.48, 2.79, 2.58, 3.19, 3.71, 2.19, 1.83, 1.46, 2.42, 1.67, 2.2, 3.81, 2.99, 3.75, 2.61, 1.64, 1.07, 2.19, 2.98, 2.15, 2.39, 3.09, 2.38, 2.22, 1.75, 2.32, 2.76, 1.09, 1.94, 2.97, 2.17, 2.21, 2.62, 2.92, 1.99, 2.95, 2.91, 3.45, 2.85, 1.99, 2.28, 3.18, 2.94, 2.47)
lipidsy[moltype] = ( 3.98, 2.64, 2.36, 2.75, 2.2, 2.04, 2.29, 2.41, 1.37, 0.79, 0.29, 0.29, 0.55, 1.71, 1.75, 2.14, 2.69, 3.23, 2.89, 2.62, 1.57, 1.82, 1.14, 0.24, 1.66, 1.83, 1.3, 0.83, 3.05, 3.13, 3.6, 3.49, 2.01, 2.33, 1.56, 2.33, 1.04, 2.57, 3.27, 3.78, 4.14, 2.09, 2.69, 3.22, 3.3, 3.72, 4.29, 3.11, 2.92, 3.02, 3.55, 2.54, 2.4, 1.77, 1.97, 1.4, 2.49, 2.02, 2.48, 2.82, 3.16, 3.55, 4.24, 3.94, 4.14, 2.69, 3.82, 3.13, 2.45, 3.35, 3.07, 2.54, 3.06, 2.17, 2.63, 2.78, 3.34, 3.01, 3.22, 3.74, 2.91, 1.87, 2.34, 3.47, 4.12, 2.56, 2.18, 2.95, 3.8, 2.24, 1.41, 2.19, 1.97, 1.12, 1.55, 2.6, 2.74, 2.6, 2.36, 1.05, 1.33, 2.16, 1.97, 1.64, 1.9, 1.21, 0.77, 2.44, 3.08, 3.29, 1.95, 2.51, 2.24, 0.63, 0.90, 0, 1.83, 1.39, 0.91, 1.79, 2.8, 2.74, 1.49, 0.60, 0.78, 2.15, 2.19, 2.89, 1.74, 2.24, 2.47)
lipidsz[moltype] = ( 5.11, 5.81, 5.19, 6.61, 5.16, 5.85, 4.33, 5.07, 4.76, 4.64, 3.47, 2.14, 0.76, 3.34, 1.91, 0.68, 4.43, 3.67, 2.48, 1.41, 0.65, 3.55, 2.31, 2.08, 3.69, 2.76, 1.84, 0.27, 3.83, 2.89, 1.55, 0, 7.63, 7.69, 8.58, 8.27, 9.21, 8.29, 7.81, 7.59, 7.54, 8.7, 9.61, 9.65, 10.25, 9.48, 9.91, 11.32, 11.81, 12.46, 13.14, 11.91, 11.06, 10.69, 10.38, 11.08, 13.26, 13.83, 14.27, 15.57, 14.92, 15.36, 15.39, 14.85, 14.14, 16.68, 16.99, 17.43, 16.45, 17.14, 16.22, 23.56, 22.44, 21.96, 22.14, 23.07, 22.62, 21.35, 21.62, 21.26, 20.42, 20.41, 20.33, 19.63, 18.81, 18.86, 23.99, 24.9, 24.31, 25.56, 25.37, 25.49, 26.47, 26.74, 26.24, 27.22, 27.62, 28.14, 27.34, 27.91, 26.95, 29.08, 29.75, 28.87, 30.55, 30.54, 30.6, 31.37, 31.49, 31.32, 32.25, 32.72, 33.15, 32.2, 32.62, 32.56, 34.11, 34.9, 33.94, 35.66, 35.58, 35.64, 36.43, 36.78, 36.27, 37.2, 37.31, 37.31, 38.54, 40.12, 38.98)
lipidsa.update({ # 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
"RAMP": (moltype, "PO1 GM1 GM2 GM3 GM4 GM5 GM6 PO2 GL1 GL2 C1A C2A C3A C1B C2B C3B GL3 GL4 C1C C2C C3C C1D C2D C3D GL5 GL6 C1E C2E GL7 GL8 C1F C2F S01 S02 S03 S04 S05 S06 S07 S08 S09 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S21 S22 S23 S24 S25 S26 S27 S28 S29 S30 S31 S32 S33 S34 S35 S36 S37 S38 S39 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "),
"REMP": (moltype, "PO1 GM1 GM2 GM3 GM4 GM5 GM6 PO2 GL1 GL2 C1A C2A C3A C1B C2B C3B GL3 GL4 C1C C2C C3C C1D C2D C3D GL5 GL6 C1E C2E GL7 GL8 C1F C2F S01 S02 S03 S04 S05 S06 S07 S08 S09 S10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "),
"OANT": (moltype, "PO1 GM1 GM2 GM3 GM4 GM5 GM6 PO2 GL1 GL2 C1A C2A C3A C1B C2B C3B GL3 GL4 C1C C2C C3C C1D C2D C3D GL5 GL6 C1E C2E GL7 GL8 C1F C2F S01 S02 S03 S04 S05 S06 S07 S08 S09 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S21 S22 S23 S24 S25 S26 S27 S28 S29 S30 S31 S32 S33 S34 S35 S36 S37 S38 S39 O40 O41 O42 O43 O44 O45 O46 O47 O48 O49 O50 O51 O52 O53 O54 O55 O56 O57 O58 O59 O60 O61 O62 O63 O64 O65 O66 O67 O68 O69 O70 O71 O72 O73 O74 O75 O76 O77 O78 O79 O80 O81 O82 O83 O84 O85 O86 O87 O88 O89 O90 O91 O92 O93 O94 O95 O96 O97 O98 O99"),
})
# Lists for automatic charge determination
charges = {"ARG":1, "LYS":1, "ASP":-1, "GLU":-1, "DLPG":-1, "DOPG":-1, "POPG":-1, "DOPS":-1, "POPS":-1, "DSSQ":-1, "POP2":-5, "POP3":-7, "REMP":-6, "RAMP":-10, "OANT":-10, "CDL1":-1, "CDL2":-2, "CDL":-2}
a, b = math.sqrt(2)/20, math.sqrt(2)/60
ct, st = math.cos(math.pi*109.47/180), math.sin(math.pi*109.47/180) # Tetrahedral
# Get a set of coordinates for a solvent particle with a given name
# Dictionary of solvents; First only those with multiple atoms
solventParticles = {
"PW": (("W",(-0.07,0,0)), # Polarizable water
("WP",(0.07,0,0)),
("WM",(0.07,0,0))),
"BMW": (("C",(0,0,0)),
("Q1",(0.12,0,0)),
("Q2",(-0.06,math.cos(math.pi/6)*0.12,0))), # BMW water
"SPC": (("OW",(0,0,0)), # SPC
("HW1",(0.01,0,0)),
("HW2",(0.01*ct,0.01*st,0))),
"SPCM": (("OW",(0,0,0)), # Multiscale/Martini SPC
("HW1",(0.01,0,0)),
("HW2",(0.01*ct,0.01*st,0)),
("vW",(0,0,0))),
"FG4W": (("OW1",(a,a,a)), # Bundled water
("HW11",(a,a-b,a-b)),
("HW12",(a,a+b,a+b)),
("OW2",(a,-a,-a)),
("HW21",(a-b,-a,-a+b)),
("HW22",(a+b,-a,-a-b)),
("OW3",(-a,-a,a)),
("HW31",(-a,-a+b,a-b)),
("HW32",(-a,-a-b,a+b)),
("OW4",(-a,a,-a)),
("HW41",(-a+b,a,-a+b)),
("HW42",(-a-b,a,-a-b))),
"FG4W-MS": (("OW1",(a,a,a)), # Bundled water, multiscaled
("HW11",(a,a-b,a-b)),
("HW12",(a,a+b,a+b)),
("OW2",(a,-a,-a)),
("HW21",(a-b,-a,-a+b)),
("HW22",(a+b,-a,-a-b)),
("OW3",(-a,-a,a)),
("HW31",(-a,-a+b,a-b)),
("HW32",(-a,-a-b,a+b)),
("OW4",(-a,a,-a)),
("HW41",(-a+b,a,-a+b)),
("HW42",(-a-b,a,-a-b)),
("VZ",(0,0,0))),
"GLUC": (("B1",(-0.11, 0, 0)),
("B2",( 0.05, 0.16,0)),
("B3",( 0.05,-0.16,0))),
"FRUC": (("B1",(-0.11, 0, 0)),
("B2",( 0.05, 0.16,0)),
("B3",( 0.05,-0.16,0))),
"SUCR": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
"MALT": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
"CELL": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
"KOJI": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
"SOPH": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
"NIGE": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
"LAMI": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
"TREH": (("B1",(-0.25, 0.25,0)),
("B2",(-0.25, 0, 0)),
("B3",(-0.25,-0.25,0)),
("B4",( 0.25, 0, 0)),
("B5",( 0.25, 0.25,0)),
("B6",( 0.25,-0.25,0))),
# Loose aminoacids
"GLY": (("BB", ( 0, 0, 0)),),
"ALA": (("BB", ( 0, 0, 0)),),
"ASN": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"ASP": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"GLU": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"GLN": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"LEU": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"ILE": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"VAL": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"SER": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"THR": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"CYS": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"MET": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"LYS": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"PRO": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"HYP": (("BB", ( 0.25, 0, 0)),
("SC1",(-0.25, 0, 0))),
"ARG": (("BB", ( 0.25, 0, 0)),
("SC1",( 0, 0, 0)),
("SC2",(-0.25, 0.125, 0))),
"PHE": (("BB", ( 0.25, 0, 0)),
("SC1",( 0, 0, 0)),
("SC2",(-0.25,-0.125, 0)),
("SC3",(-0.25, 0.125, 0))),
"TYR": (("BB", ( 0.25, 0, 0)),
("SC1",( 0, 0, 0)),
("SC2",(-0.25,-0.125, 0)),
("SC3",(-0.25, 0.125, 0))),
"TRP": (("BB", ( 0.25, 0.125, 0)),
("SC1",( 0.25, 0, 0)),
("SC2",( 0, -0.125, 0)),
("SC3",( 0, 0.125, 0)),
("SC4",(-0.25, 0, 0))),
}
# Update the solvents dictionary with single atom ones
for s in ["W","NA","CL","Mg","K","BUT"]:
solventParticles[s] = ((s,(0,0,0)),)
# Apolar amino acids nd stuff for orienting proteins in membrane
apolar = "ALA CYS PHE ILE LEU MET VAL TRP PLM CLR".split()
## PRIVATE PARTS FROM THIS POINT ON ##
S = str
F = float
I = int
R = random.random
def vector(v):
if type(v) == str and "," in v:
return [float(i) for i in v.split(",")]
return float(v)
def vvadd(a,b):
if type(b) in (int,float):
return [i+b for i in a]
return [i+j for i,j in zip(a,b)]
def vvsub(a,b):
if type(b) in (int,float):
return [i-b for i in a]
return [i-j for i,j in zip(a,b)]
def isPDBAtom(l):
return l.startswith("ATOM") or l.startswith("HETATM")
def pdbAtom(a):
##01234567890123456789012345678901234567890123456789012345678901234567890123456789
##ATOM 2155 HH11 ARG C 203 116.140 48.800 6.280 1.00 0.00
## ===> atom name, res name, res id, chain, x, y, z
return (S(a[12:16]),S(a[17:20]),I(a[22:26]),a[21],F(a[30:38])/10,F(a[38:46])/10,F(a[46:54])/10)
d2r = 3.14159265358979323846264338327950288/180
def pdbBoxRead(a):
# Convert a PDB CRYST1 entry to a lattice definition.
# Convert from Angstrom to nanometer
fa, fb, fc, aa, ab, ac = [float(i) for i in a.split()[1:7]]
ca, cb, cg, sg = math.cos(d2r*aa), math.cos(d2r*ab), math.cos(d2r*ac) , math.sin(d2r*ac)
wx, wy = 0.1*fc*cb, 0.1*fc*(ca-cb*cg)/sg
wz = math.sqrt(0.01*fc*fc - wx*wx - wy*wy)
return [0.1*fa, 0, 0, 0.1*fb*cg, 0.1*fb*sg, 0, wx, wy, wz]
def groAtom(a):
#012345678901234567890123456789012345678901234567890
# 1PRN N 1 4.168 11.132 5.291
## ===> atom name, res name, res id, chain, x, y, z
return (S(a[10:15]), S(a[5:10]), I(a[:5]), " ", F(a[20:28]),F(a[28:36]),F(a[36:44]))
def groBoxRead(a):
b = [F(i) for i in a.split()] + 6*[0] # Padding for rectangular boxes
return b[0],b[3],b[4],b[5],b[1],b[6],b[7],b[8],b[2]
def readBox(a):
x = [ float(i) for i in a.split(",") ] + 6*[0]
if len(x) == 12: # PDB format
return pdbBoxRead("CRYST1 "+" ".join([str(i) for i in x]))
else: # GRO format
return x[0],x[3],x[4],x[5],x[1],x[6],x[7],x[8],x[2]
class Structure:
def __init__(self,filename=None):
self.title = ""
self.atoms = []
self.coord = []
self.rest = []
self.box = []
self._center = None
if filename:
lines = open(filename).readlines()
# Try extracting PDB atom/hetatm definitions
self.rest = []
self.atoms = [pdbAtom(i) for i in lines if isPDBAtom(i) or self.rest.append(i)]
if self.atoms:
# This must be a PDB file
self.title = "THIS IS INSANE!\n"
for i in self.rest:
if i.startswith("TITLE"):
self.title = i
self.box = [0,0,0,0,0,0,0,0,0]
for i in self.rest:
if i.startswith("CRYST1"):
self.box = pdbBoxRead(i)
else:
# This should be a GRO file
self.atoms = [groAtom(i) for i in lines[2:-1]]
self.rest = [lines[0],lines[1],lines[-1]]
self.box = groBoxRead(lines[-1])
self.title = lines[0]
self.coord = [i[4:7] for i in self.atoms]
self.center()
def __nonzero__(self):
return bool(self.atoms)
def __len__(self):
return len(self.atoms)
def __iadd__(self,s):
for i in range(len(self)):
self.coord[i] = vvadd(self.coord[i],s)
return self
def center(self,other=None):
if not self._center:
self._center = [ sum(i)/len(i) for i in zip(*self.coord)]
if other:
s = vvsub(other,self._center)
for i in range(len(self)):
self.coord[i] = vvadd(self.coord[i],s)
self._center = other
return s # return the shift
return self._center
def diam(self):
if self._center != (0,0,0):
self.center((0,0,0))
return 2*math.sqrt(max([i*i+j*j+k*k for i,j,k in self.coord]))
def diamxy(self):
if self._center != (0,0,0):
self.center((0,0,0))
return 2*math.sqrt(max([i*i+j*j for i,j,k in self.coord]))
def fun(self,fn):
return [fn(i) for i in zip(*self.coord)]
# Mean of deviations from initial value
def meand(v):
return sum([i-v[0] for i in v])/len(v)
# Sum of squares/crossproducts of deviations
def ssd(u,v):
return sum([(i-u[0])*(j-v[0]) for i,j in zip(u,v)])/(len(u)-1)
# Parse a string for a lipid as given on the command line (LIPID[:NUMBER])
def parse_mol(x):
l = x.split(":")
return l[0], len(l) == 1 and 1 or float(l[1])
## MIJN EIGEN ROUTINE ##
# Quite short piece of code for diagonalizing symmetric 3x3 matrices :)
# Analytic solution for third order polynomial
def solve_p3( a, b, c ):
Q,R,a3 = (3*b-a**2)/9.0, (-27*c+a*(9*b-2*a**2))/54.0, a/3.0
if Q**3 + R**2:
t,R13 = math.acos(R/math.sqrt(-Q**3))/3, 2*math.sqrt(-Q)
u,v,w = math.cos(t), math.sin(t+math.pi/6), math.cos(t+math.pi/3)
return R13*u-a3, -R13*v-a3, -R13*w-a3
else:
R13 = math.sqrt3(R)
return 2*R13-a3, -R13-a3, -R13-a3
# Normalization of 3-vector
def normalize(a):
f = 1.0/math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])
return f*a[0],f*a[1],f*a[2]
# Eigenvectors for a symmetric 3x3 matrix:
# For symmetric matrix A the eigenvector v with root r satisfies
# v.Aw = Av.w = rv.w = v.rw
# v.(A-rI)w = v.Aw - v.rw = 0 for all w
# This means that for any two vectors p,q the eigenvector v follows from:
# (A-rI)p x (A-rI)q
# The input is var(x),var(y),var(z),cov(x,y),cov(x,z),cov(y,z)
# The routine has been checked and yields proper eigenvalues/-vectors
def mijn_eigen_sym_3x3(a,d,f,b,c,e):
a,d,f,b,c,e=1,d/a,f/a,b/a,c/a,e/a
b2, c2, e2, df = b*b, c*c, e*e, d*f
roots = list(solve_p3(-a-d-f, df-b2-c2-e2+a*(f+d), a*e2+d*c2+f*b2-a*df-2*b*c*e))
roots.sort(reverse=True)
ux, uy, uz = b*e-c*d, b*c-a*e, a*d-b*b
u = (ux+roots[0]*c,uy+roots[0]*e,uz+roots[0]*(roots[0]-a-d))
v = (ux+roots[1]*c,uy+roots[1]*e,uz+roots[1]*(roots[1]-a-d))
w = u[1]*v[2]-u[2]*v[1],u[2]*v[0]-u[0]*v[2],u[0]*v[1]-u[1]*v[0] # Cross product
return normalize(u),normalize(v),normalize(w),roots
# Very simple option class
class Option:
def __init__(self,func=str,num=1,default=None,description=""):
self.func = func
self.num = num
self.value = default
self.description = description
def __nonzero__(self):
return self.value != None
def __str__(self):
return self.value and str(self.value) or ""
def setvalue(self,v):
if len(v) == 1:
self.value = self.func(v[0])
else:
self.value = [ self.func(i) for i in v ]
tm = []
lipL = []
lipU = []
solv = []
# HII edit - lipid definition, for extra lipid definitaions
usrmols = []
usrheads = []
usrlinks = []
usrtails = []
usrLipHeadMapp = { # Define supported lipid head beads. One letter name mapped to atom name
"C": ('NC3'), # NC3 = Choline
"E": ('NH3'), # NH3 = Ethanolamine
"G": ('GL0'), # GL0 = Glycerol
"S": ('CNO'), # CNO = Serine
"P": ('PO4'), # PO4 = Phosphate
"O": ('PO4') # PO4 = Phosphate acid
}
usrIndexToLetter = "A B C D E F G H I J K L M N".split() # For naming lipid tail beads
# Description
desc = ""
# Option list
options = [
# option type number default description
# HII edit - lipid definition (last options are for additional lipid specification)
"""
Input/output related options
""",
("-f", Option(tm.append, 1, None, "Input GRO or PDB file 1: Protein")),
("-o", Option(str, 1, None, "Output GRO file: Membrane with Protein")),
("-p", Option(str, 1, None, "Optional rudimentary topology file")),
"""
Periodic boundary conditions
If -d is given, set up PBC according to -pbc such that no periodic
images are closer than the value given. This will make the numbers
provided for lipids be interpreted as relative numbers. If -d is
omitted, those numbers are interpreted as absolute numbers, and the
PBC are set to fit the given number of lipids in.
""",
("-pbc", Option(str, 1, "hexagonal", "PBC type: hexagonal, rectangular, square, cubic, optimal or keep")),
("-d", Option(float, 1, 0, "Distance between periodic images (nm)")),
("-dz", Option(float, 1, 0, "Z distance between periodic images (nm)")),
("-x", Option(vector, 1, 0, "X dimension or first lattice vector of system (nm)")),
("-y", Option(vector, 1, 0, "Y dimension or first lattice vector of system (nm)")),
("-z", Option(vector, 1, 0, "Z dimension or first lattice vector of system (nm)")),
("-box", Option(readBox, 1, None, "Box in GRO (3 or 9 floats) or PDB (6 floats) format, comma separated")),
("-n", Option(str, 1, None, "Index file --- TO BE IMPLEMENTED")),
"""
Membrane/lipid related options.
The options -l and -u can be given multiple times. Option -u can be
used to set the lipid type and abundance for the upper leaflet. Option
-l sets the type and abundance for the lower leaflet if option -u is
also given, or for both leaflets if option -u is not given. The
meaning of the number depends on whether option -d is used to set up
PBC
""",
("-l", Option(lipL.append, 1, None, "Lipid type and relative abundance (NAME[:#])")),
("-u", Option(lipU.append, 1, None, "Lipid type and relative abundance (NAME[:#])")),
("-a", Option(float, 1, 0.60, "Area per lipid (nm*nm)")),
("-au", Option(float, 1, None, "Area per lipid (nm*nm) for upper layer")),
("-asym", Option(int, 1, None, "Membrane asymmetry (number of lipids)")),
("-hole", Option(float, 1, None, "Make a hole in the membrane with specified radius")),
("-disc", Option(float, 1, None, "Make a membrane disc with specified radius")),
("-rand", Option(float, 1, 0.1, "Random kick size (maximum atom displacement)")),
("-bd", Option(float, 1, 0.3, "Bead distance unit for scaling z-coordinates (nm)")),
"""
Protein related options.
""",
("-center", Option(bool, 0, None, "Center the protein on z")),
("-orient", Option(bool, 0, None, "Orient protein in membrane")),
("-rotate", Option(str, 1, None, "Rotate protein (random|princ|angle(float))")),
("-od", Option(float, 1, 1.0, "Grid spacing for determining orientation")),
("-op", Option(float, 1, 4.0, "Hydrophobic ratio power for determining orientation")),
("-fudge", Option(float, 1, 0.1, "Fudge factor for allowing lipid-protein overlap")),
("-ring", Option(bool, 0, None, "Put lipids inside the protein")),
("-dm", Option(float, 1, None, "Shift protein with respect to membrane")),
"""
Solvent related options.
""",
("-sol", Option(solv.append, 1, None, "Solvent type and relative abundance (NAME[:#])")),
("-sold", Option(float, 1, 0.5, "Solvent diameter")),
("-solr", Option(float, 1, 0.1, "Solvent random kick")),
("-excl", Option(float, 1, 1.5, "Exclusion range (nm) for solvent addition relative to membrane center")),
"""
Salt related options.
""",
("-salt", Option(str, 1, None, "Salt concentration")),
("-charge", Option(str, 1, "auto", "Charge of system. Set to auto to infer from residue names")),
"""
Define additional lipid types (same format as in lipid-martini-itp-v01.py)
""",
("-alname", Option(usrmols.append, 1, None, "Additional lipid name, x4 letter")),
("-alhead", Option(usrheads.append, 1, None, "Additional lipid head specification string")),
("-allink", Option(usrlinks.append, 1, None, "Additional lipid linker specification string")),
("-altail", Option(usrtails.append, 1, None, "Additional lipid tail specification string")),
]
args = sys.argv[1:]
if '-h' in args or '--help' in args:
print "\n",__file__
print desc or "\nSomeone ought to write a description for this script...\n"
for thing in options:
print type(thing) != str and "%10s %s"%(thing[0],thing[1].description) or thing
print
sys.exit()
# Convert the option list to a dictionary, discarding all comments
options = dict([i for i in options if not type(i) == str])
# Process the command line
while args:
ar = args.pop(0)
options[ar].setvalue([args.pop(0) for i in range(options[ar].num)])
# Read in the structures (if any)
tm = [ Structure(i) for i in tm ]
absoluteNumbers = not options["-d"]
# HII edit - lipid definition
# Add specified lipid definition to insane lipid library
for name, head, link, tail in zip(usrmols,usrheads,usrlinks,usrtails):
moltype = "usr_"+name
lipidsx[moltype] = []
lipidsy[moltype] = []
lipidsz[moltype] = []
headArray = (head).split()
linkArray = (link).split()
tailsArray = (tail).split()
lipidDefString = ""
if len(tailsArray) != len(linkArray):
print "Error, Number of tails has to equal number of linkers"
sys.exit()
# Find longest tail
maxTail = 0
for cTail in tailsArray:
if len(cTail) > maxTail:
maxTail = len(cTail)
cBeadZ = maxTail + len(headArray) # longest tail + linker (always x1) + lengths of all heads - 1 (as it starts on 0)
# Add head beads
for cHead in headArray:
lipidsx[moltype].append(0)
lipidsy[moltype].append(0)
lipidsz[moltype].append(cBeadZ)
cBeadZ -= 1
lipidDefString += usrLipHeadMapp[cHead] + " "
# Add linkers
for i,cLinker in enumerate(linkArray):
lipidsx[moltype].append(max(i-0.5,0))
lipidsy[moltype].append(0)
lipidsz[moltype].append(cBeadZ)
if cLinker == 'G':
lipidDefString += "GL" + str(i+1) + " "
elif cLinker == 'A':
lipidDefString += "AM" + str(i+1) + " "
else:
print "Error, linker type not supported"
sys.exit()
# Add tails
for i,cTail in enumerate(tailsArray):
cBeadZ = maxTail - 1
for j,cTailBead in enumerate(cTail):
lipidsx[moltype].append(i)
lipidsy[moltype].append(0)
lipidsz[moltype].append(cBeadZ)
cBeadZ -= 1
lipidDefString += cTailBead + str(j+1) + usrIndexToLetter[i] + " "
lipidsa[name] = (moltype,lipidDefString)
# End user lipid definition
# HII edit - lipid definition, had to move this one below the user lipid definitions to scale them to.
# First all X/Y coordinates of templates are centered and scaled (magic numbers!)
for i in lipidsx.keys():
cx = (min(lipidsx[i])+max(lipidsx[i]))/2
lipidsx[i] = [0.25*(j-cx) for j in lipidsx[i]]
cy = (min(lipidsy[i])+max(lipidsy[i]))/2
lipidsy[i] = [0.25*(j-cy) for j in lipidsy[i]]
# Periodic boundary conditions
# option -box overrides everything
if options["-box"]:
options["-x"].value = options["-box"].value[:3]
options["-y"].value = options["-box"].value[3:6]
options["-z"].value = options["-box"].value[6:]
# option -pbc keep really overrides everything
if options["-pbc"].value == "keep" and tm:
options["-x"].value = tm[0].box[:3]
options["-y"].value = tm[0].box[3:6]
options["-z"].value = tm[0].box[6:]
# options -x, -y, -z take precedence over automatic determination
pbcSetX = 0
if type(options["-x"].value) in (list,tuple):
pbcSetX = options["-x"].value
elif options["-x"].value:
pbcSetX = [options["-x"].value,0,0]
pbcSetY = 0
if type(options["-y"].value) in (list,tuple):
pbcSetY = options["-y"].value
elif options["-y"].value:
pbcSetY = [0,options["-y"].value,0]
pbcSetZ = 0
if type(options["-z"].value) in (list,tuple):
pbcSetZ = options["-z"].value
elif options["-z"].value:
pbcSetZ = [0,0,options["-z"].value]
lo_lipd = math.sqrt(options["-a"].value)
up_lipd = options["-au"].value or lo_lipd
################
## I. PROTEIN ##
################
protein = Structure()
prot = []
xshifts = [0] # Shift in x direction per protein
## A. NO PROTEIN ---
if not tm:
resi = 0
# Set the box -- If there is a disc/hole, add its radius to the distance
if options["-disc"]:
pbcx = pbcy = pbcz = options["-d"].value + 2*options["-disc"].value
elif options["-hole"]:
pbcx = pbcy = pbcz = options["-d"].value + 2*options["-hole"].value
else:
pbcx = pbcy = pbcz = options["-d"].value
if "hexagonal".startswith(options["-pbc"].value):
# Hexagonal prism -- y derived from x directly
pbcy = math.sqrt(3)*pbcx/2
pbcz = options["-dz"].value or options["-z"].value or options["-d"].value
elif "optimal".startswith(options["-pbc"].value):
# Rhombic dodecahedron with hexagonal XY plane
pbcy = math.sqrt(3)*pbcx/2
pbcz = math.sqrt(6)*options["-d"].value/3
if "rectangular".startswith(options["-pbc"].value):
pbcz = options["-dz"].value or options["-z"].value or options["-d"].value
# Possibly override
pbcx = pbcSetX and pbcSetX[0] or pbcx
pbcy = pbcSetY and pbcSetY[1] or pbcy
pbcz = pbcSetZ and pbcSetZ[2] or pbcz
## B. PROTEIN ---
else:
for prot in tm:
## a. NO MEMBRANE --
if not lipL:
# A protein, but don't add lipids... Just solvate the protein
# Maybe align along principal axes and then build a cell according to PBC
# Set PBC starting from diameter and adding distance
if "cubic".startswith(options["-pbc"].value):
pbcx = pbcy = pbcz = prot.diam()+options["-d"].value
elif "rectangular".startswith(options["-pbc"].value):
pbcx, pbcy, pbcz = vvadd(vvsub(prot.fun(max),prot.fun(min)),options["-d"].value)
else:
# Rhombic dodecahedron
pbcx = pbcy = prot.diam()+options["-d"].value
pbcz = math.sqrt(2)*pbcx/2
# Possibly override
pbcx = pbcSetX and pbcSetX[0] or pbcx
pbcy = pbcSetY and pbcSetY[1] or pbcy
pbcz = pbcSetZ and pbcSetZ[2] or pbcz
# Center coordinates in rectangular brick -- Add solvent next
if len(tm) == 1:
prot.center((0.5*pbcx, 0.5*pbcy, 0.5*pbcz))
# Do not set an exclusion range for solvent
options["-excl"].value = -1
## b. PROTEIN AND MEMBRANE --
else:
# Have to build a membrane around the protein.
# So first put the protein in properly.
# Center the protein and store the shift
shift = prot.center((0,0,0))
## 1. Orient with respect to membrane
# Orient the protein according to the TM region, if requested
# This doesn't actually work very well...
if options["-orient"]:
# Grid spacing (nm)
d = options["-od"].value
pw = options["-op"].value
# Determine grid size
mx,my,mz = prot.fun(min)
rx,ry,rz = prot.fun(lambda x: max(x)-min(x)+1e-8)
# Number of grid cells
nx,ny,nz = int(rx/d+0.5),int(ry/d+0.5),int(rz/d+0.5)
# Initialize grids
atom = [[[0 for i in range(nz+2)] for j in range(ny+2)] for k in range(nx+2)]
phobic = [[[0 for i in range(nz+2)] for j in range(ny+2)] for k in range(nx+2)]
surface = []
for i, (ix, iy, iz) in zip(prot.atoms,prot.coord):
if i[1] != "DUM":