-
Notifications
You must be signed in to change notification settings - Fork 1
/
SpeciFlex_compare.c
3635 lines (3421 loc) · 112 KB
/
SpeciFlex_compare.c
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
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#define strkeq(s1,s2,k) ( k<=0 ? 1 : s1[0]==s2[0] ? !strncmp(s1,s2,(k)) : 0)
#define column(n) (linebuf+(n)-1)
/*#define TRACE*/
#define UNKNOWN -1
/***** PDB file van der Waals Radii Definitions *****/
/***** Small adjustments made by L Kuhn, 7/31/07, to match *****/
/***** data in Table XI: The Minimum Radii of Atoms, in Li & Nussinov (1998)
"A Set of van der Waals and Coulombic Radii of Protein Atoms for Molecular
and Solvent-Accessible Surface Calculation, Packing Evaluation, and Docking",
Proteins 21, 111-127. *****/
/***** Instructions to add a new atom type *****/
/* Add a radius definition below, then add the atom type
assignment in read_pdb.c (see that file at 'ADD ATOM'),
and add the atom name definition in inc/defs.h (also at
'ADD ATOM' in that file */
#define RAD_ACEO 1.26
#define RAD_ACEC 1.62
#define RAD_ACECA 1.73
#define RAD_ALAN 1.43
#define RAD_ALACA 1.73
#define RAD_ALAC 1.62
#define RAD_ALAO 1.26
#define RAD_ALAOXT 1.24
#define RAD_ALACB 1.66
#define RAD_ARGN 1.43
#define RAD_ARGCA 1.73
#define RAD_ARGC 1.62
#define RAD_ARGO 1.26
#define RAD_ARGOXT 1.24
#define RAD_ARGCB 1.69
#define RAD_ARGCG 1.68
#define RAD_ARGCD 1.62
#define RAD_ARGNE 1.34
#define RAD_ARGCZ 1.62
#define RAD_ARGNH1 1.34
#define RAD_ARGNH2 1.34
#define RAD_ASNN 1.43
#define RAD_ASNCA 1.73
#define RAD_ASNC 1.62
#define RAD_ASNO 1.26
#define RAD_ASNOXT 1.24
#define RAD_ASNCB 1.69
#define RAD_ASNCG 1.67
#define RAD_ASNOD1 1.20
#define RAD_ASNND2 1.31
#define RAD_ASNAD1 1.25 /* average of OD1 and ND2 */
#define RAD_ASNAD2 1.25 /* average of OD1 and ND2 */
#define RAD_ASPN 1.43
#define RAD_ASPCA 1.73
#define RAD_ASPC 1.62
#define RAD_ASPO 1.26
#define RAD_ASPOXT 1.24
#define RAD_ASPCB 1.69
#define RAD_ASPCG 1.65
#define RAD_ASPOD1 1.24
#define RAD_ASPOD2 1.24
#define RAD_CYSN 1.43
#define RAD_CYSCA 1.73
#define RAD_CYSC 1.62
#define RAD_CYSO 1.26
#define RAD_CYSOXT 1.24
#define RAD_CYSCB 1.69
#define RAD_CYSSG 1.54
#define RAD_GLNN 1.43
#define RAD_GLNCA 1.73
#define RAD_GLNC 1.62
#define RAD_GLNO 1.26
#define RAD_GLNOXT 1.24
#define RAD_GLNCB 1.69
#define RAD_GLNCG 1.62
#define RAD_GLNCD 1.67
#define RAD_GLNOE1 1.20
#define RAD_GLNNE2 1.31
#define RAD_GLNAE1 1.25 /* average of OE1 and NE2 */
#define RAD_GLNAE2 1.25 /* average of OE1 and NE2 */
#define RAD_GLUN 1.43
#define RAD_GLUCA 1.73
#define RAD_GLUC 1.62
#define RAD_GLUO 1.26
#define RAD_GLUOXT 1.24
#define RAD_GLUCB 1.69
#define RAD_GLUCG 1.62
#define RAD_GLUCD 1.65
#define RAD_GLUOE1 1.24
#define RAD_GLUOE2 1.24
#define RAD_GLYN 1.43
#define RAD_GLYCA 1.68 /* CH2 atom type in Li & Nussinov */
#define RAD_GLYC 1.62
#define RAD_GLYO 1.26
#define RAD_GLYOXT 1.24
#define RAD_HISN 1.43
#define RAD_HISCA 1.73
#define RAD_HISC 1.62
#define RAD_HISO 1.26
#define RAD_HISOXT 1.24
#define RAD_HISCB 1.69
#define RAD_HISCG 1.62
#define RAD_HISND1 1.38
#define RAD_HISCD2 1.50
#define RAD_HISCE1 1.50
#define RAD_HISNE2 1.38
#define RAD_ILEN 1.43
#define RAD_ILECA 1.73
#define RAD_ILEC 1.62
#define RAD_ILEO 1.26
#define RAD_ILEOXT 1.24
#define RAD_ILECB 1.82
#define RAD_ILECG1 1.68
#define RAD_ILECG2 1.66
#define RAD_ILECD1 1.66
#define RAD_LEUN 1.43
#define RAD_LEUCA 1.73
#define RAD_LEUC 1.62
#define RAD_LEUO 1.26
#define RAD_LEUOXT 1.24
#define RAD_LEUCB 1.69
#define RAD_LEUCG 1.82
#define RAD_LEUCD1 1.66
#define RAD_LEUCD2 1.66
#define RAD_LYSN 1.43
#define RAD_LYSCA 1.73
#define RAD_LYSC 1.62
#define RAD_LYSO 1.26
#define RAD_LYSOXT 1.24
#define RAD_LYSCB 1.69
#define RAD_LYSCG 1.68
#define RAD_LYSCD 1.68
#define RAD_LYSCE 1.62
#define RAD_LYSNZ 1.22
#define RAD_METN 1.43
#define RAD_METCA 1.73
#define RAD_METC 1.62
#define RAD_METO 1.26
#define RAD_METOXT 1.24
#define RAD_METCB 1.69
#define RAD_METCG 1.68
#define RAD_METSD 1.67
#define RAD_METCE 1.66
#define RAD_PHEN 1.43
#define RAD_PHECA 1.73
#define RAD_PHEC 1.62
#define RAD_PHEO 1.26
#define RAD_PHEOXT 1.24
#define RAD_PHECB 1.69
#define RAD_PHECG 1.62
#define RAD_PHECD1 1.62
#define RAD_PHECD2 1.62
#define RAD_PHECE1 1.62
#define RAD_PHECE2 1.62
#define RAD_PHECZ 1.62
#define RAD_PRON 1.43
#define RAD_PROCA 1.73
#define RAD_PROC 1.62
#define RAD_PROO 1.26
#define RAD_PROOXT 1.24
#define RAD_PROCB 1.69
#define RAD_PROCG 1.68
#define RAD_PROCD 1.68
#define RAD_SERN 1.43
#define RAD_SERCA 1.73
#define RAD_SERC 1.62
#define RAD_SERO 1.26
#define RAD_SEROXT 1.24
#define RAD_SERCB 1.69
#define RAD_SEROG 1.30
#define RAD_THRN 1.43
#define RAD_THRCA 1.73
#define RAD_THRC 1.62
#define RAD_THRO 1.26
#define RAD_THROXT 1.24
#define RAD_THRCB 1.82
#define RAD_THROG1 1.30
#define RAD_THRCG2 1.66
#define RAD_TRPN 1.43
#define RAD_TRPCA 1.73
#define RAD_TRPC 1.62
#define RAD_TRPO 1.26
#define RAD_TRPOXT 1.24
#define RAD_TRPCB 1.69
#define RAD_TRPCG 1.62
#define RAD_TRPCD1 1.62
#define RAD_TRPCD2 1.62
#define RAD_TRPNE1 1.35
#define RAD_TRPCE2 1.62
#define RAD_TRPCE3 1.62
#define RAD_TRPCZ2 1.62
#define RAD_TRPCZ3 1.62
#define RAD_TRPCH2 1.62
#define RAD_TYRN 1.43
#define RAD_TYRCA 1.73
#define RAD_TYRC 1.62
#define RAD_TYRO 1.26
#define RAD_TYROXT 1.24
#define RAD_TYRCB 1.69
#define RAD_TYRCG 1.62
#define RAD_TYRCD1 1.62
#define RAD_TYRCD2 1.62
#define RAD_TYRCE1 1.62
#define RAD_TYRCE2 1.62
#define RAD_TYRCZ 1.62
#define RAD_TYROH 1.30
#define RAD_VALN 1.43
#define RAD_VALCA 1.73
#define RAD_VALC 1.62
#define RAD_VALO 1.26
#define RAD_VALOXT 1.24
#define RAD_VALCB 1.82
#define RAD_VALCG1 1.66
#define RAD_VALCG2 1.66
#define RAD_H 1.00 /* Not from Li & Nussinov */
/***** MOL2 file van der Waals Radii Definitions *****/
/***** Instructions to add a new atom type *****/
/* Add a radius definition below, then add the atom type
assignment in assign_type.c (see that file at 'ADD MOL2 ATOM'),
add the atom radius assignment code in read_mol2.c (at
'ADD MOL2 ATOM RAD'), and add the atom name definition in
inc/defs.h (at 'ADD MOL2 ATOM') */
#define MRAD_AG 1.550
#define MRAD_AL 1.170 /* Batsanov et al has this value as 1.8 20MAR08 toneroma - previous value 1.500, Amber/Dock5 has this value as 1.17 */
#define MRAD_AS 1.700 /* Batsanov et al 20MAR08 toneroma - previous value 0.830*/
#define MRAD_AU 1.900 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_B 1.700 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_BA 3.100 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_BE 1.900 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_BI 1.800 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_BR 1.950 /* Batsanov et al has this value as 1.9 20MAR08 toneroma */
#define MRAD_CSP1 1.850
#define MRAD_CSP2 1.850
#define MRAD_CSP3 1.800
#define MRAD_CCAT 1.800
#define MRAD_CAR 1.800
#define MRAD_CDEF 1.850
#define MRAD_CA 1.600 /* Batsanov et alhas this value as 2.5 20MAR08 toneroma */
#define MRAD_CD 2.300 /* Batsanov et al 20MAR08 toneroma - previous value 1.750 */
#define MRAD_CE 1.860
#define MRAD_CL 2.030 /* Batsanov et al has this value as 1.8 20MAR08 toneroma */
#define MRAD_CO 1.130
#define MRAD_CR 1.130
#define MRAD_CS 3.500 /* Batsanov et al 20MAR08 toneroma - previous value 3.010 */
#define MRAD_CU 1.900 /* Batsanov et al 20MAR08 toneroma - previous value 1.150 */
#define MRAD_ER 1.590
#define MRAD_F 1.550 /* Batsanov et al has this value as 1.5 20MAR08 toneroma */
#define MRAD_FE 1.950
#define MRAD_GA 1.550
#define MRAD_GE 2.000 /* Batsanov et al 20MAR08 toneroma - previous value 2.720 */
#define MRAD_H 1.000
#define MRAD_HG 2.000 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_I 2.350 /* Batsanov et al has this value as 2.1 20MAR08 toneroma */
#define MRAD_IN 1.900 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_K 1.600 /* Batsanov et al has this value as 3.0 20MAR08 toneromav. The previous value in slide was 2.390, DOCK has the value as 1.600 */
#define MRAD_LA 1.830
#define MRAD_LI 1.170 /* Batsanov et al has this value as 2.6 20MAR08 toneroma - previous value 1.220, Amber/Dock5 has this value as 1.17 */
#define MRAD_MG 1.170 /* Batsanov et al has this value as 2.2 20MAR08 toneroma - previous value 1.500, Amber/Dock5 has this value as 1.17 */
#define MRAD_MN 1.190
#define MRAD_MO 1.750
#define MRAD_NSP3 1.850
#define MRAD_NSP4 1.850
#define MRAD_NDEF 1.750
#define MRAD_NA 1.600 /* Batsanov et al has this value as 2.8 20MAR08 toneroma */
#define MRAD_NI 1.240
#define MRAD_OSP3 1.650
#define MRAD_ODEF 1.600
#define MRAD_OS 2.300 /* Batsanov et al 20MAR08 toneroma - previous value 1.580 */
#define MRAD_P 2.100 /* Batsanov et al has this value as 1.7 20MAR08 toneroma */
#define MRAD_PD 1.440
#define MRAD_RB 3.200 /* Batsanov et al 20MAR08 toneroma - previous value 2.650 */
#define MRAD_RE 1.300
#define MRAD_RH 1.220
#define MRAD_RU 1.200
#define MRAD_S 2.000 /* Batsanov et al has this value as 1.8 20MAR08 toneroma */
#define MRAD_SB 1.750 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_SE 1.850 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_SI 1.900 /* Batsanov et al 20MAR08 toneroma - previous value 2.200 */
#define MRAD_SN 2.300 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_SR 2.700 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_TE 2.000 /* Batsanov et al 20MAR08 toneroma - previous value none */
#define MRAD_TI 1.950
#define MRAD_TL 2.200 /* Batsanov et al 20MAR08 toneroma - previous value 1.710 */
#define MRAD_U 1.750
#define MRAD_V 1.060
#define MRAD_Y_ 1.610
#define MRAD_ZN 2.200 /* Batsanov et al 20MAR08 toneroma - previous value 1.150 */
#define MRAD_ZR 1.420
#define MRAD_UNKNOWN 2.000
/* end define vdw radii */
/* other defs */
/* atom levels for side-chain flexibility */
#define ALPHA 0
#define BETA 1
#define GAMMA 2
#define DELTA 3
#define EPSILON 4
#define ZETA 5
#define ETA 6
/* interaction types */
#define NOTHING 16384 /* Changed from 0 to 1024 since sum-conflict of NOTHING + DONOR_HYDROGEN = DONEPTOR_DONEPTOR - Sameer 18/Feb/05*/
#define ACCEPTOR 1
#define DONOR 4
#define HYDROPHOB 16
#define DONEPTOR 64
#define DONOR_HYDROGEN 256
#define METAL_1 1024
#define METAL_2 4096
/* indices for coordinate vector */
#define X 0
#define Y 1
#define Z 2
/* all atom types */
/* To add a new PDB atom type, add a line below (with the next number),
add a radius definition in inc/vdwrad.h and add the parsing code to read_pdb.c
(instructions at 'ADD ATOM') */
/* To add a new MOL2 atom type, add a line below (with the next number),
add a radius definition in inc/vdwrad.h, add the type parsing code to
assign_type.c (instructions at 'ADD MOL2 ATOM'), and add the radius
assignment code to read_mol2.c (also at 'ADD MOL2 ATOM') */
#define CA 1
#define CB 2
#define C 3
#define O 4
#define N 5
#define CD 6
#define CD1 7
#define CD2 8
#define CE 9
#define CE1 10
#define CE2 11
#define CE3 12
#define CG 13
#define CG1 14
#define CG2 15
#define CH2 16
#define CZ 17
#define CZ2 18
#define CZ3 19
#define ND1 20
#define ND2 21
#define NE 22
#define NE1 23
#define NE2 24
#define NH1 25
#define NH2 26
#define NZ 27
#define OD1 28
#define OD2 29
#define OE1 30
#define OE2 31
#define OG 32
#define OG1 33
#define OH 34
#define OXT 35
#define SD 36
#define SG 37
#define S 40
#define P 41
#define H 42
#define SI 43
#define CO 44 /* metal type 2, hbond distance 2.6 */
#define AG 45
#define NI 46 /* metal type 1, hbond distance 2.0 */
#define BR 47
#define TL 48
#define OS 49
#define CL 50
#define LA 51
#define K 52 /* metal type 3, hbond distance 2.9 */
#define FE 53 /* metal type 2, hbond distance 2.6 */
#define DUMMY 54 /* dummy atom */
#define MO 55
#define I 56
#define AS 57
#define U 58
#define F 59
#define RE 60
#define RU 61
#define ER 62
#define LI 63
#define MN 64 /* metal type 2, hbond distance 2.6 */
#define PD 65
#define CU 66 /* metal type 2, hbond distance 2.6 */
#define AL 67
#define MG 68 /* metal type 2, hbond distance 2.6 */
#define NA 69 /* metal type 3, hbond distance 2.9 */
#define CR 70
#define CS 71
#define TI 72
#define ZN 73 /* metal type 2, hbond distance 2.6 */
#define RB 74
#define V 75
#define RH 76
#define GE 77
#define ZR 78
#define GA 79
#define Y_ 80
#define CA_M 82 /* metal type 2, this is metal "CA", not alpha carbon */
/***** Added by PCS -- 22-Mar-00 *****/
#define OC 83 /* Too Close Oxygen - Very small radius */
/* added by Litian He 03/17/2004 */
#define AD1 84 /* we have these 2 because the crystallographic can't decide O/N in ASN */
#define AD2 85
#define AE1 86 /* we have these 2 because the crystallographic can't decide O/N in GLN */
#define AE2 87
/*************************************/
#define HETATM 999
#define WATER 1000
#define ADDED 0
#define SP1 1 /* .1 */
#define SP2 2 /* .2 */
#define SP3 3 /* .3 */
/* O 4 .o */
#define SP4 5 /* .4 */
#define AR 6 /* .ar */
#define CO2 7 /* .co2 */
#define AM 8 /* .am */
#define PL3 9 /* .pl3 */
#define CAT 10 /* .cat */
#define O2 11 /* .o2 */
#define TH 12 /* .th */
#define AMBIG 13 /* .ambiguous */
#define HISN 14 /* .HIS-nitrogen */
/* OH 34 .oh */
/* all residues */
#define ALA 0
#define ARG 1
#define ASN 2
#define ASP 3
#define CYS 4
#define GLN 5
#define GLU 6
#define GLY 7
#define HIS 8
#define ILE 9
#define LEU 10
#define LYS 11
#define MET 12
#define PHE 13
#define PRO 14
#define SER 15
#define THR 16
#define TRP 17
#define TYR 18
#define VAL 19
#define ACE 20
#define PCA 21
#define HOH 22
/* atom entry in mol2 or pdb file */
typedef struct {
/* components for all atom types */
char name[5]; /* atom name in the file */
float pos[3]; /* coordinates of the atom */
float rad; /* van der Waals radius */
float charge; /* partial charge for this atom */
float charge_sum;
int atom_number; /* the number assigned to this atom in the file */
int type; /* type of the atom */
int act; /* DONOR, ACCEPTOR, DONEPTOR, NOTHING */
int *neighbors; /* indices of neighbors for intramolecular bump */
float *neighbor_dist;
int hydro; /* hydrophilicity value */
/* components only relevant for mol2 atoms */
char type_str[7]; /* string defining the atom type */
int orbit; /* orbit or whatever follows the . in type */
int number; /* number assigned to each atom for fragmentation */
int fragment; /* number of the fragment this atom is located in */
/** Added by RSK - Aug 13, 2002 **/
int subst_id; /* substructure id */
char subst_name[5]; /* substructure name */
/* components only relevant for PDB atoms */
int level; /* level of atom in side-chain */
int residue_index; /* index of the residue in the residue vector */
int res; /* the residue type identifier */
char residue[4]; /* residue type */
char alt_location; /* alternate location identifier */
char chain_id; /* chain identifier */
char insertion_code; /* insertion code */
char residue_num[5]; /* residue number */
/* components only relevant for waters */
int target_atom_index; /* atom it is connected to (H-bond) */
int state; /* CONSERVED or DISPLACED */
float prediction; /* the likelyhood of conservation */
} atom_t;
typedef atom_t *atom_pt;
void *mymalloc ( size_t size )
{
void *adr;
adr = malloc ( size );
if ( !adr )
{
fprintf( stderr, "malloc failed" );
exit (EXIT_FAILURE);
}
return ( adr );
}
float radius (int type, int orbit)
{
float rad = -1.0;
switch ( type ) {
case AL:
rad = MRAD_AL;
break;
case AG:
rad = MRAD_AG;
break;
case AS:
rad = MRAD_AS;
break;
case BR:
rad = MRAD_BR;
break;
case C:
rad = MRAD_CDEF;
break;
case CA:
rad = MRAD_CA;
break;
case CD:
rad = MRAD_CD;
break;
case CE:
rad = MRAD_CE;
break;
case CL:
rad = MRAD_CL;
break;
case CO:
rad = MRAD_CO;
break;
case CR:
rad = MRAD_CR;
break;
case CS:
rad = MRAD_CS;
break;
case CU:
rad = MRAD_CU;
break;
case ER:
rad = MRAD_ER;
break;
case F:
rad = MRAD_F;
break;
case FE:
rad = MRAD_FE;
break;
case GA:
rad = MRAD_GA;
break;
case GE:
rad = MRAD_GE;
break;
case H:
rad = MRAD_H;
break;
case I:
rad = MRAD_I;
break;
case K:
rad = MRAD_K;
break;
case LA:
rad = MRAD_LA;
break;
case LI:
rad = MRAD_LI;
break;
case MG:
rad = MRAD_MG;
break;
case MN:
rad = MRAD_MN;
break;
case MO:
rad = MRAD_MO;
break;
case N:
rad = MRAD_NDEF;
break;
case NA:
rad = MRAD_NA;
break;
case NI:
rad = MRAD_NI;
break;
case O:
rad = MRAD_ODEF;
break;
case OS:
rad = MRAD_OS;
break;
case P:
rad = MRAD_P;
break;
case PD:
rad = MRAD_PD;
break;
case RB:
rad = MRAD_RB;
break;
case RE:
rad = MRAD_RE;
break;
case RH:
rad = MRAD_RH;
break;
case RU:
rad = MRAD_RU;
break;
case S:
rad = MRAD_S;
break;
case SI:
rad = MRAD_SI;
break;
case TI:
rad = MRAD_TI;
break;
case TL:
rad = MRAD_TL;;
break;
case U:
rad = MRAD_U;
break;
case V:
rad = MRAD_V;
break;
case Y_:
rad = MRAD_Y_;
break;
case ZN:
rad = MRAD_ZN;
break;
case ZR:
rad = MRAD_ZR;
break;
case UNKNOWN:
rad = MRAD_UNKNOWN;
break;
default:
break;
}
return rad;
}
void assign_residue_type ( atom_pt atm )
{
switch ( atm->residue[0] )
{
case 'A':
switch ( atm->residue[1] )
{
case 'C':
if ( strcmp ( atm->residue, "ACE" ) == 0 )
atm->res = ACE; /*added by Litian 03/17/2004 */
break;
case 'L':
atm->res = ALA;
break;
case 'R':
atm->res = ARG;
break;
case 'S':
switch ( atm->residue[2] )
{
case 'N':
atm->res = ASN;
break;
case 'P':
atm->res = ASP;
break;
default:
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
}
break;
default:
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
}
break;
case 'C':
if ( strncmp ( atm->residue, "CYS", 3 ) == 0 )
atm->res = CYS;
else
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
case 'G':
if ( atm->residue[1] == 'L' )
switch ( atm->residue[2] )
{
case 'N':
atm->res = GLN;
break;
case 'U':
atm->res = GLU;
break;
case 'Y':
atm->res = GLY;
break;
default:
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
}
else
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
case 'H':
if (( strncmp ( atm->residue, "HIS", 3 ) == 0 ) || ( strncmp ( atm->residue, "HID", 3 ) == 0 ) || ( strncmp ( atm->residue, "HIE", 3 ) == 0 ))
atm->res = HIS;
else
if ( strncmp ( atm->residue, "HOH", 3 ) == 0 )
atm->res = HOH;
else
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
case 'I':
if ( strncmp ( atm->residue, "ILE", 3 ) == 0 )
atm->res = ILE;
else
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
case 'L':
switch ( atm->residue[1] )
{
case 'E':
atm->res = LEU;
break;
case 'Y':
atm->res = LYS;
break;
default:
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
}
break;
case 'M':
if ( strncmp ( atm->residue, "MET", 3 ) == 0 )
atm->res = MET;
else
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
case 'P':
switch ( atm->residue[1] )
{
case 'H':
atm->res = PHE;
break;
case 'R':
atm->res = PRO;
break;
case 'C': /* treat PCA (pyrrolidone carboxylic acid) like Proline */
atm->res = PCA;
break;
default:
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
}
break;
case 'S':
if ( strncmp ( atm->residue, "SER", 3 ) == 0 )
atm->res = SER;
else
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
case 'T':
switch ( atm->residue[1] )
{
case 'H':
atm->res = THR;
break;
case 'R':
atm->res = TRP;
break;
case 'Y':
atm->res = TYR;
break;
default:
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
}
break;
case 'V':
if ( strncmp ( atm->residue, "VAL", 3 ) == 0 )
atm->res = VAL;
else
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
default:
{
fprintf(stderr, "Unknown Residue: %s %s\n", atm->residue, atm->residue_num);
exit (EXIT_FAILURE);
}
break;
}
}
void assign_type_and_radius ( atom_pt atm)
{
atm->level = ALPHA; /* default level */
atm->rad = -99.9;
atm->act = NOTHING;
if ( ( strncmp ( atm->name, "N", 1 ) == 0
&& atm->res != PRO && atm->res != PCA )
|| strncmp ( atm->name, "O", 1 ) == 0 )
{
if ( strncmp ( atm->name, "N", 1 ) == 0 )
atm->act = DONOR;
if ( strncmp ( atm->name, "O", 1 ) == 0 )
atm->act = ACCEPTOR;
if ( strncmp ( atm->name, "OG", 2 ) == 0
|| strncmp ( atm->name, "OH", 2 ) == 0
|| strncmp ( atm->name, "AD", 2 ) == 0
|| strncmp ( atm->name, "AE", 2 ) == 0 )
atm->act = DONEPTOR;
}
/* The following code was added by PCS -- 2-Apr-01:
I realize there are more effecient ways to do the following (as
was the case with the previous implementation), but the following
is used to aid in human readibility and to make it easier to add
new protein atom types. Also, there are cases of redundacy
(e.g. ASP OD1 and OD2) that are assigned the same radius, but are
seperated for visual ease and possible future changes. */
/* Exception to the above are hydrogens, which all have the same
radius (RAD_H) and are parsed simply to assign their level */
/* ADD ATOM: To add a new atom type, add the radius definition in
inc/vdwrad.h, add the atom type assignment to the under the
appropriate residue below, and add a name definition to
inc/defs.h (at ADD ATOM) */
/* Assign atom types and radii based on residue names */
#ifdef TRACE
printf ("atom residue %d\n", atm->res );
#endif
switch (atm->res)
{
case ALA:
if (strcmp(atm->name,"N") == 0) {
atm->level = ALPHA;
atm->type = N;
atm->rad = RAD_ALAN;
atm->orbit = AM;
strcpy(atm->type_str, "N.am");
}
if (strcmp(atm->name,"CA") == 0) {
atm->level = ALPHA;
atm->type = CA;
atm->rad = RAD_ALACA;
atm->orbit = SP3;
strcpy(atm->type_str, "C.3");
}
if (strcmp(atm->name,"C") == 0) {
atm->level = ALPHA;
atm->type = C;
atm->rad = RAD_ALAC;
atm->orbit = SP2;
strcpy(atm->type_str, "C.2");
}
if (strcmp(atm->name,"O") == 0) {
atm->level = ALPHA;
atm->type = O;
atm->rad = RAD_ALAO;
atm->orbit = SP2;
strcpy(atm->type_str, "O.2");
}
if (strcmp(atm->name,"OXT") == 0) {
atm->level = ALPHA;
atm->type = OXT;
atm->rad = RAD_ALAOXT;
atm->orbit = CO2;
strcpy(atm->type_str, "O.co2");
}
if (strcmp(atm->name,"CB") == 0) {
atm->level = BETA;
atm->type = CB;
atm->rad = RAD_ALACB;
atm->orbit = SP3;
strcpy(atm->type_str, "C.3");
}
break;
case ACE: /*added by Litian 03/17/2004 */
if (strcmp(atm->name,"O") == 0) {
atm->level = ALPHA;
atm->type = O;
atm->rad = RAD_ACEO;
atm->orbit = SP2;
strcpy(atm->type_str, "O.2");
}
if (strcmp(atm->name,"C") == 0) {
atm->level = ALPHA;
atm->type = C;
atm->rad = RAD_ACEC;
atm->orbit = SP2;
strcpy(atm->type_str, "C.2");
}
if (strcmp(atm->name,"CH3") == 0) {
atm->level = ALPHA;
atm->type = CA;
atm->rad = RAD_ACECA;
atm->orbit = SP3;
strcpy(atm->type_str, "C.3");
}
break;
case ARG:
if (strcmp(atm->name,"N") == 0) {
atm->level = ALPHA;
atm->type = N;
atm->rad = RAD_ARGN;
atm->orbit = AM;
strcpy(atm->type_str, "N.am");
}
if (strcmp(atm->name,"CA") == 0) {
atm->level = ALPHA;
atm->type = CA;
atm->rad = RAD_ARGCA;
atm->orbit = SP3;
strcpy(atm->type_str, "C.3");
}
if (strcmp(atm->name,"C") == 0) {
atm->level = ALPHA;