-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcg_energetics_mod.f
5464 lines (4096 loc) · 187 KB
/
cg_energetics_mod.f
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
c This file, with all the subroutines, was written originally by
c Dr. Z.T.Chu, under the guidance of Dr. Warshel
c It was originally written for the research purposes of Dr. Ben Messer
c Since 2009, it was heavily modified by Spyridon Vicatos, Anna Rychkova
c Anatoly Dryga, and Arieh Warshel, for research purposes
c Most comments, written by Spyridon Vicatos
c
c I apologize in advance for some inelegant comments, and some
c innefficient subroutines, but due to the lack of time
c I had to do my best with coding, while at the same time the code had
c to be as understandable as possible.
C Spyridon Vicatos, Jan 2011
c--------------------------------------------------------------------------
subroutine init_cg(hit_lib)
implicit none
include 'include/parameter.dc'
include 'include/Mdyn.h'
include 'include/seq.h'
include 'include/cbkv_gap.h'
include 'include/sequ.h'
include 'include/coord.h'
include 'include/dgm_pt.h'
include 'include/cg_ion_hyd_pol_constants.h'
c local var:
integer i,ii,j,n_sim,i_sim,n_sim_type,i_polr(nsimpres),hit,hit_lib
character*3 semonte_predict_charge,inpq_n,seq_n
c This common is used ONLY in this subroutine!
common/init_pol_data/i_polr
write(6,*)"INIT CG IS RUNNING!!!!!"
c The DATA for the simplified residues!!!!
c include 'include/simp_data.h'
call simp_data
if(default_cg_energy_c) then
call cg_energy_c_data
endif
chu get the nonbond list for each hydrophobic CG residue
chu looks you guys copyed and renamed cg_nonbond_list to cb_nonbond_list1,
chu then we can removed cg_nonbond_list
chu call cg_nonbond_list
c.......................................................................
c'
n_sim_type=nsimpres ! Set the number of simp types as nsimpres
c ! which is a parameter set into the parameter.dc file
c Provide the library, where you set all the charges for the
c Ionizable residues (aka Arg, Lys, Glu, Asp, His)
if(.not.lsimple_crg) then ! If the simple_charge file does not exist
c Set all the "types" of residues to zero!
c Set all "simple charges" to zero!
do i=1,numres
is_sim(i)=0
i_sim_type(i)=0
sim_q(i)=0.0
enddo
c assign the correct dielectrics
eff_diel(1) = 40.0
eff_diel(2) = 10.0
c Try to initialize the charges and the "polarities" correctly
do i=1,numres
do j=1,5
if(resseq(i).eq.typ_nam(j)) then
sim_q(i) = typ_crg(j)
is_sim(i)=1 !
goto 944
endif
enddo
944 enddo
endif
c read in simple_side_lib, if user provided, otherwise use the above
c default data
if(hit_lib.eq.1) then
read(89,*)n_sim_type
if(n_sim_type.gt.50) then
write(6,'('' ERROR: # of simplified residue types > 50,'',
$ '' there are no > 50 of folding types'',/,
$ '' in the amino.lib'')')
goto 666
endif
c Read the VDW parameters and the "type" of the residue
do i=1,n_sim_type
read(89,*)seq_sim1(i),sim_a(i),sim_c(i),i_polr(i)
enddo
c if(n_sim_type.lt.38) then
c write(6,'(/,'' ERROR: missing residues in your'',
c $ '' simple_side_lib'',/)')
c goto 666
c endif
endif
do i=1,numres
if(seq(i).eq.'MEB') then
is_sim(i)=4 ! Set the "type" as "membrane"
else
do j=1,n_sim_type
if(l_exp_simp) then
seq_n=ex_n(j)
else
seq_n=seq_sim1(j)
endif
if(seq(i).eq.seq_n)then
i_sim_type(i)=j
if(lsimple_crg.and.is_sim(i).eq.1) goto 10
if(is_sim(i).eq.0)then
if(i_polr(j).eq.1) then
is_sim(i)=2 !polar
else
is_sim(i)=3 !nonpolar
endif
endif
goto 10
endif
enddo
endif
10 enddo
c set charge to 0.0 for polar and nonpolar sidechain united atoms
do i=1,numres
if(is_sim(i).eq.2.or.is_sim(i).eq.3) then
do ii=np(i)+1,np(i+1)
if(bkvcode(ii)(1:2).eq.'CB')crg(ii)=0.0d0
enddo
endif
enddo
write(6,'(/,'' polarity type of the system:'')')
write(6,'('' res# resname polarity (1: ionized, 2: polar,'',
$ '' 3: nonpolr, 0: N/A)'')')
do i=1,numres
write(6,'(i5,6x,a3,8x,i2)')i,seq(i),is_sim(i)
enddo
print *
close(89)
c.......................................................................
return
666 call killme ('init_polarity')
end
c-----------------------------------------------------------------------
subroutine simple_vdw
implicit none
include 'include/parameter.dc'
include 'include/coord.h'
if (lsimple) then
call coarseg_vdw ! Coarse Grained
elseif (lsimple_alfa) then
call simp_ca_vdw ! Simple CA
else
write(6,*)"ERROR, the type of Simp Model was not specified correctly"
stop " STOPPED in simple_vdw subroutine, due to error!"
endif
return
end
c-----------------------------------------------------------------------
subroutine coarseg_vdw
c
implicit none
include 'include/parameter.dc'
include 'include/coord.h'
include 'include/seq.h'
include 'include/cbkv_gap.h'
include 'include/Mdyn.h'
include 'include/task.h'
include 'include/derivative.h'
include 'include/stepsize.h'
include 'include/symbols.h'
include 'include/sequ.h'
c local var:
integer i,j,ii,jj,k,ihit,jhit,i3,j3,m,iaci
real*8 dx1,dx2,dx3,r1,r2,r3,r6,r8,a,b,c,df,df_vdw,c_factor,
$ r_eq,r_eq2,r_eq4,r_eq6,r_eq8,r_eq12
real*8 c_opt ! scale constant for the collection of E_opt
real*8 vdw_cut_param, r6old ! vdw between protein and membrane (Anna Apr 2011)
c......................................................................
sim_vdw=0.0
pseudo_sim_vdw = 0.0d0
sim_po_vdw=0.0
e_opt = 0.0d0
c write(6,*)" Coarse Grained VDW IS RUNNING"
do i=1,numres-1
ihit=0
do j=i+1,numres
if(seq(i).eq.'MEB'.and.seq(j).eq.'MEB') goto 30
jhit=0
if((is_sim(i).eq.1.and.is_sim(j).eq.2).or. !ionic/polar
$ (is_sim(j).eq.1.and.is_sim(i).eq.2).or. !polar/ionic
$ (is_sim(i).eq.3.and.is_sim(j).eq.3).or. !nonpolr/nonpolr
$ (is_sim(i).eq.1.and.is_sim(j).eq.1).or. !ion/ion
$ (is_sim(i).eq.2.and.is_sim(j).eq.2).or. !polar/polar
$ (is_sim(i).eq.1.and.is_sim(j).eq.3).or. !ionic/nonpolar
$ (is_sim(i).eq.3.and.is_sim(j).eq.1).or. !nonpolar/ionic
$ (is_sim(i).eq.2.and.is_sim(j).eq.3).or. !polar/nonpolar
$ (is_sim(i).eq.3.and.is_sim(j).eq.2)) then !nonpolar/polar
do ii=np(i)+1,np(i+1)
if(poly_is(ii).ne.0) then
iaci = iacpa(poly_is(ii))
if(iac_name(iaci).eq.'DY') goto 40
iaci = iacpb(poly_is(ii))
if(iac_name(iaci).eq.'DY') goto 40
endif
if(bkvcode(ii)(1:2).eq.'CB') then
ihit=ii
goto 10
endif
enddo
if(ihit.eq.0) goto 40
10 do jj=np(j)+1,np(j+1)
if(poly_is(jj).ne.0) then
iaci = iacpa(poly_is(jj))
if(iac_name(iaci).eq.'DY') goto 30
iaci = iacpb(poly_is(jj))
if(iac_name(iaci).eq.'DY') goto 30
endif
if(bkvcode(jj)(1:2).eq.'CB') then
jhit=jj
goto 20
endif
enddo
if(jhit.eq.0) goto 30
20 i3 = ihit*3-3
j3 = jhit*3-3
dx1 = x(i3+1)-x(j3+1)
dx2 = x(i3+2)-x(j3+2)
dx3 = x(i3+3)-x(j3+3)
r2 = dx1*dx1+dx2*dx2+dx3*dx3
r2 = 1.d0/r2
r1 = sqrt(r2)
r3 = r1*r2
r6 = r3*r3
r8 = r2*r6
c Declare some important scale constants
c########################################################################
c
c_factor=1.0
c_opt = 1.30d0
if((is_sim(i).eq.3.and.(is_sim(j).eq.1.or.is_sim(j).eq.2)).or.
$ (is_sim(j).eq.3.and.(is_sim(i).eq.1.or.is_sim(i).eq.2))) then
c_factor=c_scale
endif
c=sqrt(sim_c(i_sim_type(i))*sim_c(i_sim_type(j)))/c_factor
r_eq=sqrt(sim_a(i_sim_type(i))*sim_a(i_sim_type(j)))
c write(6,*)"sim_c i sim_c j e_factor c"
c write(6,'(f8.2,3x,f8.2,3x,f8.2,3x,f8.2)')
c $ sim_c(i_sim_type(i)), sim_c(i_sim_type(j)), c_factor, c
c write(6,*)
c write(6,*)"sim_a i sim_a j r_eq"
c write(6,'(f8.2,3x,f8.2,3x,f8.2)')
c $ sim_a(i_sim_type(i)), sim_a(i_sim_type(j)), r_eq
r_eq2=r_eq*r_eq
r_eq4=r_eq2*r_eq2
r_eq6=r_eq4*r_eq2
r_eq8=r_eq4*r_eq4
a = 3.0*r_eq8*r8
b = -4.0*r_eq6*r6
c write(6,*)
c write(6,*)"a b "
c write(6,'(f8.2,3x,f8.2)')
c $ a,b
df_vdw=8.0*a+6.0*b
df=-r2*c*df_vdw
do m=1,npoly
if(ihit.eq.ipoly(m).or.jhit.eq.ipoly(m))then
sim_po_vdw=sim_po_vdw+c*(a+b)
endif
enddo
do m=1,n_mut_gly
if(ihit.eq.i_mut_gly(m).or.jhit.eq.i_mut_gly(m))then
sim_po_vdw=sim_po_vdw+c*(a+b)
df=df*formwgt
endif
enddo
c
c
c
c
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c Calculate van der waals interactions
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c |||||||||||||||||
c |||||||
c |||
c V
sim_vdw=sim_vdw+c*(a+b)
if(1.0d0/r1.lt.r_eq) then
pseudo_sim_vdw = pseudo_sim_vdw +c*(3.0*r_eq8/r_eq8 -4.0*r_eq6/r_eq6 )
else
pseudo_sim_vdw = pseudo_sim_vdw +c*(a+b)
endif
c write(6,*)"PSEUDO VDW is ", pseudo_sim_vdw
c write(6,*)"Contribution ",i,j,c*(a+b), sim_vdw
c write(6,*)
c write(6,*)" sim_vdw ihit jhit r1"
c write(6,*) sim_vdw, ihit, jhit, 1.0/r1
c write(6,*)
c
c
c
c
c###############################################################
c###############################################################
C CHECKING AND COLLECTING values for the E_opt
c
if(1.0d0/r1.gt.r_eq*c_opt) then
e_opt = e_opt + c*(a+b)
c write(6,*)'DEBUG!!!! Residue, Residue, E_OPT '
c write(6,*)i,j,e_opt,c*(a+b)
else
e_opt = e_opt - c*c_factor
c write(6,*)'DEBUG!!!! Residue, Residue, E_OPT '
c write(6,*)i,j,e_opt,c*c_factor
endif
c if((i.ge.63).and.(i.le.67)) Then
c write(6,*)'DEBUG!!!! Residue, Residue, r1, r_eq VDW c*factor '
c'
c write(6,*)i,j,1.0d0/r1, r_eq, c*(a+b),c*c_factor
c endif
c write(6,*)'e_hydro',i,e_hydro
c###############################################################
if(check_sim.eq.1) then
write(6,'('' simple polarity for residues:'',2i4,
$ '' side atoms:'',2i6)')i,j,ihit,jhit
write(6,'('' r_eq:'',2f10.3,'' C_factor:'',2f10.3)')
$ sim_a(i_sim_type(i)),sim_a(i_sim_type(j)),
$ sim_c(i_sim_type(i)),sim_c(i_sim_type(j))
write(6,'('' c_scaling factor:'',f8.2)')c_factor
write(6,'('' rij :'',f10.3,11x,'' sim_vdw:'',f10.3,
$ '' sum:'',f10.3,/)')
$ 1.0/r1,c*(a+b),sim_vdw
endif
35 continue
d(i3+1)=d(i3+1)+df*dx1
d(i3+2)=d(i3+2)+df*dx2
d(i3+3)=d(i3+3)+df*dx3
d(j3+1)=d(j3+1)-df*dx1
d(j3+2)=d(j3+2)-df*dx2
d(j3+3)=d(j3+3)-df*dx3
endif
c#################################################################
c vdw between protein and membrane atoms [Anna, Apr 2011]
if((is_sim(i).eq.4.and.is_sim(j).ne.4).or. !CB of MEB with CB of protein
$ (is_sim(j).eq.4.and.is_sim(i).ne.4)) then
do ii=np(i)+1,np(i+1)
if(poly_is(ii).ne.0) then
iaci = iacpa(poly_is(ii))
if(iac_name(iaci).eq.'DY') goto 40
iaci = iacpb(poly_is(ii))
if(iac_name(iaci).eq.'DY') goto 40
endif
if(bkvcode(ii)(1:2).eq.'CB') then
ihit=ii
goto 50
endif
enddo
if(ihit.eq.0) goto 40
50 do jj=np(j)+1,np(j+1)
if(poly_is(jj).ne.0) then
iaci = iacpa(poly_is(jj))
if(iac_name(iaci).eq.'DY') goto 30
iaci = iacpb(poly_is(jj))
if(iac_name(iaci).eq.'DY') goto 30
endif
if(bkvcode(jj)(1:2).eq.'CB') then
jhit=jj
goto 60
endif
enddo
if(jhit.eq.0) goto 30
60 i3 = ihit*3-3
j3 = jhit*3-3
dx1 = x(i3+1)-x(j3+1)
dx2 = x(i3+2)-x(j3+2)
dx3 = x(i3+3)-x(j3+3)
r2 = dx1*dx1+dx2*dx2+dx3*dx3
r2 = 1.d0/r2
r1 = sqrt(r2)
r3 = r1*r2
r6 = r3*r3
vdw_cut_param = 7452.75
c vdw_cut_param was calculated as an average of all the solutions {V[r]=0,r=0} for all
c possible interactions between CB of 19 residues and CB of MEB.
c Equilibrium diameters and well depths for CB atoms were taken from the simp_data.f. [Anna]
r6 = 1.0d0/r6
r6old = r6 ! Actual r^6
r6 = r6 + vdw_cut_param
r6 = 1.0d0/r6 ! 1 / (vdw_cut_param + r^6)
c=sqrt(sim_c(i_sim_type(i))*sim_c(i_sim_type(j)))
r_eq=0.5d0*(sim_a(i_sim_type(i))+sim_a(i_sim_type(j)))
r_eq2=r_eq*r_eq
r_eq4=r_eq2*r_eq2
r_eq6=r_eq4*r_eq2
r_eq12=r_eq6*r_eq6
a = 4.0d0*c*r_eq12
b = -4.0d0*c*r_eq6
sim_vdw=sim_vdw+(a*r6*r6+b*r6)
pseudo_sim_vdw = pseudo_sim_vdw + (a*r6*r6+b*r6)
c write(6,*)'DEBUG: MEB-prot'
c write(6,'(''i j'',2i3)')i,j
c write(6,'(''i_sim_type(j) i_sim_type(j)'',2i2)')i_sim_type(i),i_sim_type(j)
c write(6,'(''well_depth eq_radius for i'',2f10.2)')sim_c(i_sim_type(i)),sim_a(i_sim_type(i))
c write(6,'(''well_depth eq_radius for j'',2f10.2)')sim_c(i_sim_type(j)),sim_a(i_sim_type(j))
c write(6,'(''c r_eq ''2f10.2)'),c,r_eq
c write(6,'(''dist'',f10.2)')1/r1
c write(6,'(''sim_vdw'',f20.2)')a*r6*r6+b*r6
df_vdw = (12*a*r6 + 6*b)*r6old*r6*r6
df = -r2*df_vdw
d(i3+1)=d(i3+1)+df*dx1
d(i3+2)=d(i3+2)+df*dx2
d(i3+3)=d(i3+3)+df*dx3
d(j3+1)=d(j3+1)-df*dx1
d(j3+2)=d(j3+2)-df*dx2
d(j3+3)=d(j3+3)-df*dx3
endif
c end of the vdw between membrane and protein
c##################################################################
30 enddo
40 enddo
c...........................................................................
c write(6,*)"COARSE VDW RESULT IS ", sim_vdw
return
end
c---------------------------------------------------------------------------
c-----------------------------------------------------------------------
subroutine simp_ca_vdw
c
implicit none
include 'include/parameter.dc'
include 'include/coord.h'
include 'include/seq.h'
include 'include/cbkv_gap.h'
include 'include/Mdyn.h'
include 'include/task.h'
include 'include/derivative.h'
include 'include/stepsize.h'
include 'include/symbols.h'
include 'include/sequ.h'
c local var:
integer i,j,ii,jj,k,ihit,jhit,i3,j3,m,iaci
real*8 dx1,dx2,dx3,r1,r2,r3,r6,r8,a,b,c,df,df_vdw,c_factor,
$ r_eq,r_eq2,r_eq4,r_eq6,r_eq8
real*8 r_i, r_j, epsilon_i, epsilon_j,alanine_r,alanine_eps
real*8 c_opt ! scale constant for the collection of E_opt
c......................................................................
sim_vdw=0.0
sim_po_vdw=0.0
e_opt = 0.0d0
c write(6,*)" Simple C_Alpha VDW IS RUNNING"
C parameters for the CA
alanine_r = 4.24
alanine_eps = 0.050d0
do i=1,numres-1
do j=i+1,numres
if(seq(i).eq.'MEB'.and.seq(j).eq.'MEB') goto 30 ! get out of the j loop
if((is_sim(i).eq.1.and.is_sim(j).eq.2).or. !ionic/polar
$ (is_sim(j).eq.1.and.is_sim(i).eq.2).or. !polar/ionic
$ (is_sim(i).eq.3.and.is_sim(j).eq.3).or. !nonpolr/nonpolr
$ (is_sim(i).eq.1.and.is_sim(j).eq.1).or. !ion/ion
$ (is_sim(i).eq.2.and.is_sim(j).eq.2).or. !polar/polar
$ (is_sim(i).eq.1.and.is_sim(j).eq.3).or. !ionic/nonpolar
$ (is_sim(i).eq.3.and.is_sim(j).eq.1).or. !nonpolar/ionic
$ (is_sim(i).eq.2.and.is_sim(j).eq.3).or. !polar/nonpolar
$ (is_sim(i).eq.3.and.is_sim(j).eq.2)) then !nonpolar/polar
do ii=np(i)+1,np(i+1)
C define the vdw variables for residue i
if(bkvcode(ii)(1:2).eq.'CB') then
r_i = sim_a(i_sim_type(i))
epsilon_i = sim_c(i_sim_type(i))
else if(bkvcode(ii)(1:2).eq.'CA') then
r_i = alanine_r
epsilon_i = alanine_eps
endif
do jj=np(j)+1,np(j+1)
C define the vdw variables for residue j
if(bkvcode(jj)(1:2).eq.'CB') then
r_j = sim_a(i_sim_type(j))
epsilon_j = sim_c(i_sim_type(j))
else if(bkvcode(ii)(1:2).eq.'CA') then
r_j = alanine_r
epsilon_j = alanine_eps
endif
c Calculate vdw values
c
i3 = ii*3-3
j3 = jj*3-3
dx1 = x(i3+1)-x(j3+1)
dx2 = x(i3+2)-x(j3+2)
dx3 = x(i3+3)-x(j3+3)
r2 = dx1*dx1+dx2*dx2+dx3*dx3
r2 = 1.d0/r2
r1 = sqrt(r2)
r3 = r1*r2
r6 = r3*r3
r8 = r2*r6
c Declare some important scale constants
c########################################################################
c
c_factor=1.0
c_opt = 1.30d0
if((is_sim(i).eq.3.and.(is_sim(j).eq.1.or.is_sim(j).eq.2)).or.
$ (is_sim(j).eq.3.and.(is_sim(i).eq.1.or.is_sim(i).eq.2))) then
c_factor=c_scale
endif
c=sqrt(epsilon_i*epsilon_j)/c_factor
r_eq=sqrt(r_i*r_j)
r_eq2=r_eq*r_eq
r_eq4=r_eq2*r_eq2
r_eq6=r_eq4*r_eq2
r_eq8=r_eq4*r_eq4
a = 3.0*r_eq8*r8
b = -4.0*r_eq6*r6
df_vdw=8.0*a+6.0*b
df=-r2*c*df_vdw
c NOTE
c Some parts of the original vdw subroutine that addreses the
c Calculations of sim_po_vdw are ommited!!!!
c
c
c
c
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c Calculate van der waals interactions
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
c |||||||||||||||||
c |||||||
c |||
c V
sim_vdw=sim_vdw+c*(a+b)
c write(6,*)"SIM CA "
c write(6,*)"R =",1/r1
c write(6,*)"a and b =",a,b
c write(6,*)"c =",c
c write(6,*)"contr = ",c*(a+b)
c write(6,*)"VDW TOTAL IS ",sim_vdw
c write(6,*)
c
c###############################################################
c###############################################################
C CHECKING AND COLLECTING values for the E_opt
c
if(1.0d0/r1.gt.r_eq*c_opt) then
e_opt = e_opt + c*(a+b)
else
e_opt = e_opt - c*c_factor
endif
c###############################################################
c UPDATE THE FORCES!
d(i3+1)=d(i3+1)+df*dx1
d(i3+2)=d(i3+2)+df*dx2
d(i3+3)=d(i3+3)+df*dx3
d(j3+1)=d(j3+1)-df*dx1
d(j3+2)=d(j3+2)-df*dx2
d(j3+3)=d(j3+3)-df*dx3
enddo ! End of do jj=np(j)+1,np(j+1)
enddo ! End of do ii=np(i)+1,np(i+1)
endif ! End of the long if statement where (
c is_sim(i).eq.1.and.is_sim(j).eq.2).or. !ionic/polar
c etc!!!!
30 enddo
enddo
c...........................................................................
return
end
c---------------------------------------------------------------------------
subroutine simple_neighbor_self_e
c calculate the interaction of ion and nonpolar residues with polar and nonpolar neighbors
c and membrane atoms
implicit none
include 'include/parameter.dc'
include 'include/coord.h'
include 'include/seq.h'
include 'include/cbkv_gap.h'
include 'include/Mdyn.h'
include 'include/task.h'
include 'include/derivative.h'
include 'include/symbols.h'
include 'include/stepsize.h'
include 'include/lib.h'
include 'include/cg_ion_hyd_pol_constants.h'
include 'include/dgm_pt.h'
include 'include/rWatProtein.h'
include 'include/filename.h'
c local var:>
integer i,j,ii,jj,k,m,ihit,jhit,i3,j3,irun,iw,
$ hit,hit_gly,option,
$ icount,par_derivative_type, res_type,res_type0, get
real*8 dx1,dx2,dx3,r1,r2,r3,df,u_temp,temp_u,e_self_np,e_self_p,e_self_mem,DM,
$ temp_u_np,temp_u_mem, temp_u1, temp_u2
real*8 c_polar, c_np, c_mem,temp_energy
real*8 max_polar, max_nonpolar, max_mem, r_min_cote1, r_min_cote2
real*8 c_pol(19), c_nonpol(19), c_membrane(19), coefficient_np(19),
$ coefficient_p(19), coeff_polar
real*8 bins_polar(19,10), bins_nonpolar(19,20)
integer bin
integer current_i_type
real*8 fact_u1, fact_u2
real*8 temp_nonpolar, temp_polar, temp_mem, temp_general
real*8 sum_t_np_hydro, sum_t_p_hydro, sum_t_mem_hydro
real*8 sum_t_np_polar, sum_t_p_polar, sum_t_mem_polar
integer Nw(numres), Nw_ring(numres), Nw_water(20)
integer ng_range_old, start_old, end_old
c The integers where the number of the following residues are stored
integer n_ala, n_leu, n_ile, n_val, n_prol, n_met, n_phe, n_trp
integer n_ser, n_thr, n_tyr, n_cys, n_asn, n_gln
c Langevin grid variable (part are obsolete)
real*8 r_ld_min0, alpha_min,x1_1,y1,y2, cote
c all variables describing neighbours are real now (so we can have 1.67 neighbours)
c (required for correct usage of F(rij) = exp (-6(r-rnp)^2))
real*8 t_mem_ngb, t_p_ngb, t_np_ngb, c_mem_factor
c F(rij) values (see Rychkova, Vicatos, Warshel PNAS)
real*8 mem_sim_ngb, p_sim_ngb, np_sim_ngb
c cutoff radius for mem neighbours
c will be assigned to mem_spacing*f (f=2.05)
c real*8 r_mem_ngb_cutoff
c number of neighbours for ion in the membrane
c should not strongly depend on membrane spacing
c mem in two solvation shells are included
c within r<mem_spacing*f
real*8 max_mem_ngb
c closest distance to water from participated residue
real*8 distanceToWater
character seq_tmp*3, type*5
logical debug, print_option
c real*8 E_main_CG ! main chain solvatation penalty
c real*8 E_hydro_CG ! Hbond in CG model
real*8 MainChainSolvation ! function for calculation
real*8 HydrogenBond_CG ! function for calculation
c......................................................................
if(run_old_self_e) then
call old_self_energy
return
endif
get = 1
max_polar = 6.0d0 ! At 6/25/2012 was 10.0 . At 6/27/2012 as a test, became 6
max_nonpolar = 15.0d0
max_mem_ngb = 28.0d0 !number is approximate smth between 25 and 30 will probably work
C The two factors for the hydrophobic energy
fact_u1 = 1.0d0 ! for Nw
fact_u2 = 0.0d0 ! for N neighbor
r_min_cote1 = 18.0d0
r_min_cote2 = 12.0d0
icount=icount+1
debug=.true.
debug=.false.
print_option=.false.
if(lcheck_self) debug=.true.
c is_sim()=1 ion
c is_sim()=2 polar
c is_sim()=3 nonpolar
c is_sim()=4 membrane
c Keep this for development
c write(6,*)"Success!!!! simple neighbor is running"
t_sim_ngb=0.0
c DEFAULT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
c Nw_water(1) = 26 ! ALA
c Nw_water(2) = 26 ! VAL
c Nw_water(3) = 38 ! LEU
c Nw_water(4) = 54 ! ILE
c Nw_water(5) = 26 ! PRO
c Nw_water(6) = 100 ! LYS
c Nw_water(7) = 100 ! HIS
c Nw_water(8) = 54 ! PHE
c Nw_water(9) = 100 ! TYR
c Nw_water(10) = 90 ! TRP ! could be 90 as well, its under debate
c Nw_water(11) = 100 ! ASN
c Nw_water(12) = 100 ! GLN
c Nw_water(13) = 100 ! SER
c Nw_water(14) = 100 ! THR
c Nw_water(15) = 100 ! ARG
c Nw_water(16) = 100 ! ASP
c Nw_water(17) = 100 ! GLU
c Nw_water(18) = 100 ! CYS
c Nw_water(19) = 26 ! MET
C Set some fictitious values for Nw_water
c 'A*2','V*2','L*2','I*2','P*2','K*2','H*2','F*2','Y*2','W*2',
c 'N*2','Q*2','S*2','T*2','R*2','D*2','E*2','C*2','M*2','H*2',
c 'A*3','T*3','C*3','G*3'
Nw_water(1) = 60 ! ALA
Nw_water(2) = 110 ! VAL
Nw_water(3) = 115 ! LEU
Nw_water(4) = 120 ! ILE
Nw_water(5) = 50 ! PRO
Nw_water(6) = 100 ! LYS
Nw_water(7) = 100 ! HIS
Nw_water(8) = 130 ! PHE
Nw_water(9) = 100 ! TYR
Nw_water(10) = 140 ! TRP ! could be 90 as well, its under debate
Nw_water(11) = 100 ! ASN
Nw_water(12) = 100 ! GLN
Nw_water(13) = 100 ! SER
Nw_water(14) = 100 ! THR
Nw_water(15) = 100 ! ARG
Nw_water(16) = 100 ! ASP
Nw_water(17) = 100 ! GLU
Nw_water(18) = 100 ! CYS
Nw_water(19) = 110 ! MET
c variables for the gyration calculation
c ng_range_old = ng_range
c start_old = ig_start(1)
c end_old = ig_end(1)
c ng_range = 1
c ig_start(ng_range) = 1
c ig_end(ng_range) = numres
c call get_gyration_new
c Now revert to the old values, so tha the gyration subroutine be normaly used
c in other levels of MOLARIS
c ng_range = ng_range_old
c ig_start(1) = start_old
c ig_end(1) = end_old
C Reset the constants for all residues
do i=1,19
c_pol(i)=0.0d0
c_nonpol(i) = 0.0d0
c_membrane(i) = 0.0d0
coefficient_np(i) = 0.0d0
coefficient_p(i) = 0.0d0
do j=1,10
bins_polar(i,j) = 0.0d0
enddo
do j=1,20
bins_nonpolar(i,j) = 0.0d0
enddo
enddo
coeff_polar = 0.0d0
C Call subroutine that calculates and assigns ALL the constants!
call assign_cg_constants(c_pol,c_nonpol,c_membrane)
c Reassign c_membrane constants for np resi to get correct membrane contribution
c Increse by 4 for debugging purposes
c c_mem_factor=2.15
c c_membrane(6) = -0.323*c_mem_factor
c c_membrane(7) = -0.965*c_mem_factor