added source code
[unres.git] / source / unres / src_MD / src / old_F / energy_split.F.org-1
1       subroutine etotal_long(energia)
2       implicit real*8 (a-h,o-z)
3       include 'DIMENSIONS'
4 c
5 c Compute the long-range slow-varying contributions to the energy
6 c
7 #ifndef ISNAN
8       external proc_proc
9 #ifdef WINPGI
10 cMS$ATTRIBUTES C ::  proc_proc
11 #endif
12 #endif
13
14       include 'COMMON.IOUNITS'
15       double precision energia(0:n_ene),energia1(0:n_ene+1)
16       include 'COMMON.FFIELD'
17       include 'COMMON.DERIV'
18       include 'COMMON.INTERACT'
19       include 'COMMON.SBRIDGE'
20       include 'COMMON.CHAIN'
21       include 'COMMON.VAR'
22       include 'COMMON.MD'
23 c
24 c Zero out energy components
25 c
26       evdw=0.0d0
27       evdw2=0.0d0
28       evdw2_14=0.0d0
29       ees=0.0d0
30       evdw1=0.0d0
31       ecorr=0.0d0
32       ecorr5=0.0d0
33       ecorr6=0.0d0
34       eel_loc=0.0d0
35       eello_turn3=0.0d0
36       eello_turn4=0.0d0
37       eturn6=0.0d0
38       ebe=0.0d0
39       escloc=0.0d0
40       etors=0.0d0
41       etors_d=0.0d0
42       ehpb=0.0d0
43       edihcnstr=0.0d0
44       estr=0.0d0
45       esccor=0.0d0
46
47       call int_from_cart1(.false.)
48 cd    print '(a,i2)','Calling etotal ipot=',ipot
49 cd    print *,'nnt=',nnt,' nct=',nct
50 C
51 C Compute the side-chain and electrostatic interaction energy
52 C
53       goto (101,102,103,104,105,106) ipot
54 C Lennard-Jones potential.
55   101 call elj(evdw)
56 cd    print '(a)','Exit ELJ'
57       goto 107
58 C Lennard-Jones-Kihara potential (shifted).
59   102 call eljk(evdw)
60       goto 107
61 C Berne-Pechukas potential (dilated LJ, angular dependence).
62   103 call ebp(evdw)
63       goto 107
64 C Gay-Berne potential (shifted LJ, angular dependence).
65   104 call egb(evdw)
66       goto 107
67 C Gay-Berne-Vorobjev potential (shifted LJ, angular dependence).
68   105 call egbv(evdw)
69       goto 107
70 C Soft-sphere potential
71   106 call e_softsphere(evdw)
72 C
73 C Calculate electrostatic (H-bonding) energy of the main chain.
74 C
75   107 continue
76 c      print *,"Processor",myrank," computed USCSC"
77       call vec_and_deriv
78 c      print *,"Processor",myrank," left VEC_AND_DERIV"
79       if (ipot.lt.6) then
80 #ifdef SPLITELE
81          if (welec.gt.0d0.or.wvdwpp.gt.0d0.or.wel_loc.gt.0d0.or.
82      &       wturn3.gt.0d0.or.wturn4.gt.0d0) then
83 #else
84          if (welec.gt.0d0.or.wel_loc.gt.0d0.or.
85      &       wturn3.gt.0d0.or.wturn4.gt.0d0) then
86 #endif
87             call eelec(ees,evdw1,eel_loc,eello_turn3,eello_turn4)
88          else
89             ees=0
90             evdw1=0
91             eel_loc=0
92             eello_turn3=0
93             eello_turn4=0
94          endif
95       else
96 c        write (iout,*) "Soft-spheer ELEC potential"
97         call eelec_soft_sphere(ees,evdw1,eel_loc,eello_turn3,
98      &   eello_turn4)
99       endif
100 C
101 C Calculate excluded-volume interaction energy between peptide groups
102 C and side chains.
103 C
104       if (ipot.lt.6) then
105       call escp(evdw2,evdw2_14)
106       else
107 c        write (iout,*) "Soft-sphere SCP potential"
108         call escp_soft_sphere(evdw2,evdw2_14)
109       endif
110
111 C 12/1/95 Multi-body terms
112 C
113       n_corr=0
114       n_corr1=0
115       if ((wcorr4.gt.0.0d0 .or. wcorr5.gt.0.0d0 .or. wcorr6.gt.0.0d0 
116      &    .or. wturn6.gt.0.0d0) .and. ipot.lt.6) then
117          call multibody_eello(ecorr,ecorr5,ecorr6,eturn6,n_corr,n_corr1)
118 c         write (2,*) 'n_corr=',n_corr,' n_corr1=',n_corr1,
119 c     &" ecorr",ecorr," ecorr5",ecorr5," ecorr6",ecorr6," eturn6",eturn6
120       else
121          ecorr=0.0d0
122          ecorr5=0.0d0
123          ecorr6=0.0d0
124          eturn6=0.0d0
125       endif
126       if ((wcorr4.eq.0.0d0 .and. wcorr.gt.0.0d0) .and. ipot.lt.6) then
127          call multibody_hb(ecorr,ecorr5,ecorr6,n_corr,n_corr1)
128       endif
129 #ifndef CRYST_THET
130 C
131 C Calculate the virtual-bond-angle energy.
132 C
133 c      call ebend(ebe)
134 #endif
135 C
136 C Calculate the SC local energy.
137 C
138 #ifndef CRYST_SC
139 c      call esc(escloc)
140 #endif
141 #ifndef CRYST_TOR
142 C
143 C Calculate the virtual-bond torsional energy.
144 C
145       call etor(etors,edihcnstr)
146 #endif
147 C
148 C 6/23/01 Calculate double-torsional energy
149 C
150       call etor_d(etors_d)
151
152 C Sum the energies
153 C
154       if (wsccor.gt.0.0d0) then
155         call eback_sc_corr(esccor)
156       else
157         esccor=0.0d0
158       endif
159
160 C If performing constraint dynamics, call the constraint energy
161 C  after the equilibration time
162       if(usampl.and.totT.gt.eq_time) then
163          call EconstrQ   
164          call Econstr_back
165       else
166          Uconst=0.0d0
167          Uconst_back=0.0d0
168       endif
169 c      print *,"Processor",myrank," computed Uconstr"
170 c
171 C Sum the energies
172 C
173       energia(1)=evdw
174 #ifdef SCP14
175       energia(2)=evdw2-evdw2_14
176       energia(18)=evdw2_14
177 #else
178       energia(2)=evdw2
179       energia(18)=0.0d0
180 #endif
181 #ifdef SPLITELE
182       energia(3)=ees
183       energia(16)=evdw1
184 #else
185       energia(3)=ees+evdw1
186       energia(16)=0.0d0
187 #endif
188       energia(4)=ecorr
189       energia(5)=ecorr5
190       energia(6)=ecorr6
191       energia(7)=eel_loc
192       energia(8)=eello_turn3
193       energia(9)=eello_turn4
194       energia(10)=eturn6
195       energia(11)=ebe
196       energia(12)=escloc
197       energia(13)=etors
198       energia(14)=etors_d
199       energia(15)=ehpb
200       energia(19)=edihcnstr
201       energia(17)=estr
202       energia(20)=Uconst+Uconst_back
203       energia(21)=esccor
204       call sum_energy(energia,.true.)
205       return
206       end
207 c------------------------------------------------------------------------------
208       subroutine etotal_short(energia)
209       implicit real*8 (a-h,o-z)
210       include 'DIMENSIONS'
211 c
212 c Compute the short-range fast-varying contributions to the energy
213 c
214 #ifndef ISNAN
215       external proc_proc
216 #ifdef WINPGI
217 cMS$ATTRIBUTES C ::  proc_proc
218 #endif
219 #endif
220       include 'COMMON.IOUNITS'
221       double precision energia(0:n_ene)
222       include 'COMMON.FFIELD'
223       include 'COMMON.DERIV'
224       include 'COMMON.INTERACT'
225       include 'COMMON.SBRIDGE'
226       include 'COMMON.CHAIN'
227       include 'COMMON.VAR'
228 c
229 c Zero out energy components
230 c
231       evdw=0.0d0
232       evdw2=0.0d0
233       evdw2_14=0.0d0
234       ees=0.0d0
235       evdw1=0.0d0
236       ecorr=0.0d0
237       ecorr5=0.0d0
238       ecorr6=0.0d0
239       eel_loc=0.0d0
240       eello_turn3=0.0d0
241       eello_turn4=0.0d0
242       eturn6=0.0d0
243       ebe=0.0d0
244       escloc=0.0d0
245       etors=0.0d0
246       etors_d=0.0d0
247       ehpb=0.0d0
248       edihcnstr=0.0d0
249       estr=0.0d0
250       esccor=0.0d0
251
252       call int_from_cart1(.false.)
253 c
254 c Calculate the bond-stretching energy
255 c
256       call ebond(estr)
257
258 C Calculate the disulfide-bridge and other energy and the contributions
259 C from other distance constraints.
260       call edis(ehpb)
261 c#ifdef CRYST_THET
262 C
263 C Calculate the virtual-bond-angle energy.
264 C
265       call ebend(ebe)
266 c#endif
267 C
268 C Calculate the SC local energy.
269 C
270 c#ifdef CRYST_SC
271       call vec_and_deriv
272       call esc(escloc)
273 c#endif
274 #ifdef CRYST_TOR
275 C
276 C Calculate the virtual-bond torsional energy.
277 C
278       call etor(etors,edihcnstr)
279 #endif
280 c
281 C Sum the energies
282 C
283       energia(1)=evdw
284 #ifdef SCP14
285       energia(2)=evdw2-evdw2_14
286       energia(18)=evdw2_14
287 #else
288       energia(2)=evdw2
289       energia(18)=0.0d0
290 #endif
291 #ifdef SPLITELE
292       energia(3)=ees
293       energia(16)=evdw1
294 #else
295       energia(3)=ees+evdw1
296       energia(16)=0.0d0
297 #endif
298       energia(4)=ecorr
299       energia(5)=ecorr5
300       energia(6)=ecorr6
301       energia(7)=eel_loc
302       energia(8)=eello_turn3
303       energia(9)=eello_turn4
304       energia(10)=eturn6
305       energia(11)=ebe
306       energia(12)=escloc
307       energia(13)=etors
308       energia(14)=etors_d
309       energia(15)=ehpb
310       energia(19)=edihcnstr
311       energia(17)=estr
312       energia(20)=Uconst+Uconst_back
313       energia(21)=esccor
314       call sum_energy(energia,.true.)
315       return
316       end