f16bc1bd90a0c249047c5182848604bd3a433459
[unres.git] / source / unres / src-HCD-5D / energy_split-sep.F
1       subroutine etotal_long(energia)
2       implicit none
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 #ifdef MPI
14       include "mpif.h"
15       double precision weights_(n_ene)
16       double precision time00,time_Bcast,time_BcastW
17       integer ierror,ierr
18 #endif
19       include 'COMMON.SETUP'
20       include 'COMMON.IOUNITS'
21       double precision energia(0:n_ene)
22       include 'COMMON.FFIELD'
23       include 'COMMON.DERIV'
24       include 'COMMON.INTERACT'
25       include 'COMMON.SBRIDGE'
26       include 'COMMON.CHAIN'
27       include 'COMMON.VAR'
28       include 'COMMON.LOCAL'
29       include 'COMMON.QRESTR'
30       include 'COMMON.MD'
31       include 'COMMON.CONTROL'
32       double precision evdw,evdw1,evdw2,evdw2_14,ees,eel_loc,
33      & eello_turn3,eello_turn4,edfadis,estr,ehpb,ebe,ethetacnstr,
34      & escloc,etors,edihcnstr,etors_d,esccor,ecorr,ecorr5,ecorr6,eturn6,
35      & eliptran,Eafmforce,Etube,
36      & esaxs_constr,ehomology_constr,edfator,edfanei,edfabet
37       integer i,n_corr,n_corr1
38 c      write(iout,'(a,i2)')'Calling etotal_long ipot=',ipot
39       if (modecalc.eq.12.or.modecalc.eq.14) then
40 #ifdef MPI
41 c        if (fg_rank.eq.0) call int_from_cart1(.false.)
42 #else
43         call int_from_cart1(.false.)
44 #endif
45       endif
46 #ifdef MPI      
47 c      write(iout,*) "ETOTAL_LONG Processor",fg_rank,
48 c     & " absolute rank",myrank," nfgtasks",nfgtasks
49 c      call flush(iout)
50       if (nfgtasks.gt.1) then
51         time00=MPI_Wtime()
52 C FG slaves call the following matching MPI_Bcast in ERGASTULUM
53         if (fg_rank.eq.0) then
54           call MPI_Bcast(3,1,MPI_INTEGER,king,FG_COMM,IERROR)
55 c          write (iout,*) "Processor",myrank," BROADCAST iorder"
56 c          call flush(iout)
57 C FG master sets up the WEIGHTS_ array which will be broadcast to the 
58 C FG slaves as WEIGHTS array.
59           weights_(1)=wsc
60           weights_(2)=wscp
61           weights_(3)=welec
62           weights_(4)=wcorr
63           weights_(5)=wcorr5
64           weights_(6)=wcorr6
65           weights_(7)=wel_loc
66           weights_(8)=wturn3
67           weights_(9)=wturn4
68           weights_(10)=wturn6
69           weights_(11)=wang
70           weights_(12)=wscloc
71           weights_(13)=wtor
72           weights_(14)=wtor_d
73           weights_(15)=wstrain
74           weights_(16)=wvdwpp
75           weights_(17)=wbond
76           weights_(18)=scal14
77           weights_(21)=wsccor
78           weights_(22)=wliptran
79           weights_(25)=wtube
80           weights_(26)=wsaxs
81           weights_(28)=wdfa_dist
82           weights_(29)=wdfa_tor
83           weights_(30)=wdfa_nei
84           weights_(31)=wdfa_beta
85 C FG Master broadcasts the WEIGHTS_ array
86           call MPI_Bcast(weights_(1),n_ene,
87      &        MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
88         else
89 C FG slaves receive the WEIGHTS array
90           call MPI_Bcast(weights(1),n_ene,
91      &        MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
92           wsc=weights(1)
93           wscp=weights(2)
94           welec=weights(3)
95           wcorr=weights(4)
96           wcorr5=weights(5)
97           wcorr6=weights(6)
98           wel_loc=weights(7)
99           wturn3=weights(8)
100           wturn4=weights(9)
101           wturn6=weights(10)
102           wang=weights(11)
103           wscloc=weights(12)
104           wtor=weights(13)
105           wtor_d=weights(14)
106           wstrain=weights(15)
107           wvdwpp=weights(16)
108           wbond=weights(17)
109           scal14=weights(18)
110           wsccor=weights(21)
111           wliptran=weights(22)
112           wtube=weights(25)
113           wsaxs=weights(26)
114           wdfa_dist=weights_(28)
115           wdfa_tor=weights_(29)
116           wdfa_nei=weights_(30)
117           wdfa_beta=weights_(31)
118         endif
119         call MPI_Bcast(dc(1,1),6*nres,MPI_DOUBLE_PRECISION,
120      &    king,FG_COMM,IERR)
121          time_Bcast=time_Bcast+MPI_Wtime()-time00
122          time_Bcastw=time_Bcastw+MPI_Wtime()-time00
123 c        call chainbuild_cart
124 c        call int_from_cart1(.false.)
125       endif
126 c      write (iout,*) 'Processor',myrank,
127 c     &  ' calling etotal_short ipot=',ipot
128 c      call flush(iout)
129 c      print *,'Processor',myrank,' nnt=',nnt,' nct=',nct
130       if (nfgtasks.gt.1) then
131         call MPI_Bcast(itime_mat,1,MPI_INT,king,FG_COMM,IERROR)
132       endif
133       if (mod(itime_mat,imatupdate).eq.0) then
134         call make_SCp_inter_list
135         call make_SCSC_inter_list
136         call make_pp_inter_list
137         call make_pp_vdw_inter_list
138       endif
139 #endif     
140
141 cd    print *,'nnt=',nnt,' nct=',nct
142 C
143 C Compute the side-chain and electrostatic interaction energy
144 C
145       goto (101,102,103,104,105,106) ipot
146 C Lennard-Jones potential.
147   101 call elj_long(evdw)
148 cd    print '(a)','Exit ELJ'
149       goto 107
150 C Lennard-Jones-Kihara potential (shifted).
151   102 call eljk_long(evdw)
152       goto 107
153 C Berne-Pechukas potential (dilated LJ, angular dependence).
154   103 call ebp_long(evdw)
155       goto 107
156 C Gay-Berne potential (shifted LJ, angular dependence).
157   104 call egb_long(evdw)
158       goto 107
159 C Gay-Berne-Vorobjev potential (shifted LJ, angular dependence).
160   105 call egbv_long(evdw)
161       goto 107
162 C Soft-sphere potential
163   106 call e_softsphere(evdw)
164 C
165 C Calculate electrostatic (H-bonding) energy of the main chain.
166 C
167   107 continue
168       call vec_and_deriv
169 c      write (iout,*) "etotal_long: shield_mode",shield_mode
170       if (shield_mode.eq.1) then
171        call set_shield_fac
172       else if  (shield_mode.eq.2) then
173        call set_shield_fac2
174       endif
175
176       if (ipot.lt.6) then
177 #ifdef SPLITELE
178          if (welec.gt.0d0.or.wvdwpp.gt.0d0.or.wel_loc.gt.0d0.or.
179      &       wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
180      &       .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
181      &       .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
182 #else
183          if (welec.gt.0d0.or.wel_loc.gt.0d0.or.
184      &       wturn3.gt.0d0.or.wturn4.gt.0d0 .or. wcorr.gt.0.0d0
185      &       .or. wcorr4.gt.0.0d0 .or. wcorr5.gt.0.d0
186      &       .or. wcorr6.gt.0.0d0 .or. wturn6.gt.0.0d0 ) then
187 #endif
188            call eelec_scale(ees,evdw1,eel_loc,eello_turn3,eello_turn4)
189          else
190             ees=0
191             evdw1=0
192             eel_loc=0
193             eello_turn3=0
194             eello_turn4=0
195          endif
196       else
197 c        write (iout,*) "Soft-spheer ELEC potential"
198         call eelec_soft_sphere(ees,evdw1,eel_loc,eello_turn3,
199      &   eello_turn4)
200       endif
201 C
202 C Calculate excluded-volume interaction energy between peptide groups
203 C and side chains.
204 C
205       if (ipot.lt.6) then
206        if(wscp.gt.0d0) then
207         call escp_long(evdw2,evdw2_14)
208        else
209         evdw2=0
210         evdw2_14=0
211        endif
212       else
213         call escp_soft_sphere(evdw2,evdw2_14)
214       endif
215 #ifdef FOURBODY
216
217 C 12/1/95 Multi-body terms
218 C
219       n_corr=0
220       n_corr1=0
221       if ((wcorr4.gt.0.0d0 .or. wcorr5.gt.0.0d0 .or. wcorr6.gt.0.0d0 
222      &    .or. wturn6.gt.0.0d0) .and. ipot.lt.6) then
223          call multibody_eello(ecorr,ecorr5,ecorr6,eturn6,n_corr,n_corr1)
224 c         write (2,*) 'n_corr=',n_corr,' n_corr1=',n_corr1,
225 c     &" ecorr",ecorr," ecorr5",ecorr5," ecorr6",ecorr6," eturn6",eturn6
226       else
227          ecorr=0.0d0
228          ecorr5=0.0d0
229          ecorr6=0.0d0
230          eturn6=0.0d0
231       endif
232       if ((wcorr4.eq.0.0d0 .and. wcorr.gt.0.0d0) .and. ipot.lt.6) then
233          call multibody_hb(ecorr,ecorr5,ecorr6,n_corr,n_corr1)
234       endif
235 #endif
236
237 C If performing constraint dynamics, call the constraint energy
238 C  after the equilibration time
239       if(usampl.and.totT.gt.eq_time) then
240          call EconstrQ   
241          if (loc_qlike) then
242            call Econstr_back_qlike
243          else
244            call Econstr_back
245          endif
246       else
247          Uconst=0.0d0
248          Uconst_back=0.0d0
249       endif
250
251 C Sum the energies
252 C
253       do i=1,n_ene
254         energia(i)=0.0d0
255       enddo
256       energia(1)=evdw
257 #ifdef SCP14
258       energia(2)=evdw2-evdw2_14
259       energia(18)=evdw2_14
260 #else
261       energia(2)=evdw2
262       energia(18)=0.0d0
263 #endif
264 #ifdef SPLITELE
265       energia(3)=ees
266       energia(16)=evdw1
267 #else
268       energia(3)=ees+evdw1
269       energia(16)=0.0d0
270 #endif
271       energia(4)=ecorr
272       energia(5)=ecorr5
273       energia(6)=ecorr6
274       energia(7)=eel_loc
275       energia(8)=eello_turn3
276       energia(9)=eello_turn4
277       energia(10)=eturn6
278       energia(20)=Uconst+Uconst_back
279       energia(27)=ehomology_constr
280       energia(28)=edfadis
281       energia(29)=edfator
282       energia(30)=edfanei
283       energia(31)=edfabet
284       call sum_energy(energia,.true.)
285 c      write (iout,*) "Exit ETOTAL_LONG"
286 c      call flush(iout)
287       return
288       end
289 c------------------------------------------------------------------------------
290       subroutine etotal_short(energia)
291       implicit real*8 (a-h,o-z)
292       include 'DIMENSIONS'
293 c
294 c Compute the short-range fast-varying contributions to the energy
295 c
296 #ifndef ISNAN
297       external proc_proc
298 #ifdef WINPGI
299 cMS$ATTRIBUTES C ::  proc_proc
300 #endif
301 #endif
302 #ifdef MPI
303       include "mpif.h"
304       double precision weights_(n_ene)
305       double precision time00
306       integer ierror,ierr
307 #endif
308       include 'COMMON.SETUP'
309       include 'COMMON.IOUNITS'
310       double precision energia(0:n_ene)
311       include 'COMMON.FFIELD'
312       include 'COMMON.DERIV'
313       include 'COMMON.INTERACT'
314       include 'COMMON.SBRIDGE'
315       include 'COMMON.CHAIN'
316       include 'COMMON.VAR'
317       include 'COMMON.LOCAL'
318       include 'COMMON.CONTROL'
319       include 'COMMON.SAXS'
320       include 'COMMON.TORCNSTR'
321       double precision evdw,evdw1,evdw2,evdw2_14,ees,eel_loc,
322      & eello_turn3,eello_turn4,edfadis,estr,ehpb,ebe,ethetacnstr,
323      & escloc,etors,edihcnstr,etors_d,esccor,ecorr,ecorr5,ecorr6,eturn6,
324      & eliptran,Eafmforce,Etube,
325      & esaxs_constr,ehomology_constr,edfator,edfanei,edfabet
326       integer i,n_corr,n_corr1
327 c      write(iout,'(a,i2)')'Calling etotal_short ipot=',ipot
328 c      call flush(iout)
329       if (modecalc.eq.12.or.modecalc.eq.14) then
330 #ifdef MPI
331         if (fg_rank.eq.0) call int_from_cart1(.false.)
332 #else
333         call int_from_cart1(.false.)
334 #endif
335       endif
336 #ifdef MPI      
337 #ifndef DFA
338       edfadis=0.0d0
339       edfator=0.0d0
340       edfanei=0.0d0
341       edfabet=0.0d0
342 #endif
343 c      write(iout,*) "ETOTAL_SHORT Processor",fg_rank,
344 c     & " absolute rank",myrank," nfgtasks",nfgtasks
345 c      call flush(iout)
346       if (nfgtasks.gt.1) then
347         time00=MPI_Wtime()
348 C FG slaves call the following matching MPI_Bcast in ERGASTULUM
349         if (fg_rank.eq.0) then
350           call MPI_Bcast(2,1,MPI_INTEGER,king,FG_COMM,IERROR)
351 c          write (iout,*) "Processor",myrank," BROADCAST iorder"
352 c          call flush(iout)
353 C FG master sets up the WEIGHTS_ array which will be broadcast to the 
354 C FG slaves as WEIGHTS array.
355           weights_(1)=wsc
356           weights_(2)=wscp
357           weights_(3)=welec
358           weights_(4)=wcorr
359           weights_(5)=wcorr5
360           weights_(6)=wcorr6
361           weights_(7)=wel_loc
362           weights_(8)=wturn3
363           weights_(9)=wturn4
364           weights_(10)=wturn6
365           weights_(11)=wang
366           weights_(12)=wscloc
367           weights_(13)=wtor
368           weights_(14)=wtor_d
369           weights_(15)=wstrain
370           weights_(16)=wvdwpp
371           weights_(17)=wbond
372           weights_(18)=scal14
373           weights_(21)=wsccor
374           weights_(26)=wsaxs
375           weights_(29)=wdfa_tor
376           weights_(30)=wdfa_nei
377           weights_(31)=wdfa_beta
378 C FG Master broadcasts the WEIGHTS_ array
379           call MPI_Bcast(weights_(1),n_ene,
380      &        MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
381         else
382 C FG slaves receive the WEIGHTS array
383           call MPI_Bcast(weights(1),n_ene,
384      &        MPI_DOUBLE_PRECISION,king,FG_COMM,IERROR)
385           wsc=weights(1)
386           wscp=weights(2)
387           welec=weights(3)
388           wcorr=weights(4)
389           wcorr5=weights(5)
390           wcorr6=weights(6)
391           wel_loc=weights(7)
392           wturn3=weights(8)
393           wturn4=weights(9)
394           wturn6=weights(10)
395           wang=weights(11)
396           wscloc=weights(12)
397           wtor=weights(13)
398           wtor_d=weights(14)
399           wstrain=weights(15)
400           wvdwpp=weights(16)
401           wbond=weights(17)
402           scal14=weights(18)
403           wsccor=weights(21)
404           wsaxs=weights(26)
405         endif
406 c        write (iout,*),"Processor",myrank," BROADCAST weights"
407         call MPI_Bcast(c(1,1),maxres6,MPI_DOUBLE_PRECISION,
408      &    king,FG_COMM,IERR)
409 c        write (iout,*) "Processor",myrank," BROADCAST c"
410         call MPI_Bcast(dc(1,1),maxres6,MPI_DOUBLE_PRECISION,
411      &    king,FG_COMM,IERR)
412 c        write (iout,*) "Processor",myrank," BROADCAST dc"
413         call MPI_Bcast(dc_norm(1,1),maxres6,MPI_DOUBLE_PRECISION,
414      &    king,FG_COMM,IERR)
415 c        write (iout,*) "Processor",myrank," BROADCAST dc_norm"
416         call MPI_Bcast(theta(1),nres,MPI_DOUBLE_PRECISION,
417      &    king,FG_COMM,IERR)
418 c        write (iout,*) "Processor",myrank," BROADCAST theta"
419         call MPI_Bcast(phi(1),nres,MPI_DOUBLE_PRECISION,
420      &    king,FG_COMM,IERR)
421 c        write (iout,*) "Processor",myrank," BROADCAST phi"
422         call MPI_Bcast(alph(1),nres,MPI_DOUBLE_PRECISION,
423      &    king,FG_COMM,IERR)
424 c        write (iout,*) "Processor",myrank," BROADCAST alph"
425         call MPI_Bcast(omeg(1),nres,MPI_DOUBLE_PRECISION,
426      &    king,FG_COMM,IERR)
427 c        write (iout,*) "Processor",myrank," BROADCAST omeg"
428         call MPI_Bcast(vbld(1),2*nres,MPI_DOUBLE_PRECISION,
429      &    king,FG_COMM,IERR)
430 c        write (iout,*) "Processor",myrank," BROADCAST vbld"
431         call MPI_Bcast(vbld_inv(1),2*nres,MPI_DOUBLE_PRECISION,
432      &    king,FG_COMM,IERR)
433          time_Bcast=time_Bcast+MPI_Wtime()-time00
434 c        write (iout,*) "Processor",myrank," BROADCAST vbld_inv"
435       endif
436 c      write (iout,*) 'Processor',myrank,
437 c     &  ' calling etotal_short ipot=',ipot
438 c      call flush(iout)
439 c      print *,'Processor',myrank,' nnt=',nnt,' nct=',nct
440 #endif     
441 c      call int_from_cart1(.false.)
442 C
443 C Compute the side-chain and electrostatic interaction energy
444 C
445       goto (101,102,103,104,105,106) ipot
446 C Lennard-Jones potential.
447   101 call elj_short(evdw)
448 cd    print '(a)','Exit ELJ'
449       goto 107
450 C Lennard-Jones-Kihara potential (shifted).
451   102 call eljk_short(evdw)
452       goto 107
453 C Berne-Pechukas potential (dilated LJ, angular dependence).
454   103 call ebp_short(evdw)
455       goto 107
456 C Gay-Berne potential (shifted LJ, angular dependence).
457   104 call egb_short(evdw)
458       goto 107
459 C Gay-Berne-Vorobjev potential (shifted LJ, angular dependence).
460   105 call egbv_short(evdw)
461       goto 107
462 C Soft-sphere potential - already dealt with in the long-range part
463   106 evdw=0.0d0
464 c  106 call e_softsphere_short(evdw)
465 C
466 C Calculate electrostatic (H-bonding) energy of the main chain.
467 C
468   107 continue
469 c
470 c Calculate the short-range part of Evdwpp
471 c
472       call evdwpp_short(evdw1)
473 c
474 c Calculate the short-range part of ESCp
475 c
476       if (ipot.lt.6) then
477         call escp_short(evdw2,evdw2_14)
478       endif
479 c
480 c Calculate the bond-stretching energy
481 c
482       call ebond(estr)
483
484 C Calculate the disulfide-bridge and other energy and the contributions
485 C from other distance constraints.
486       call edis(ehpb)
487 C
488 C Calculate the virtual-bond-angle energy.
489 C
490       if (wang.gt.0d0) then
491        if (tor_mode.eq.0) then
492          call ebend(ebe)
493        else
494 C ebend kcc is Kubo cumulant clustered rigorous attemp to derive the
495 C energy function
496          call ebend_kcc(ebe)
497        endif
498       else
499         ebe=0.0d0
500       endif
501       ethetacnstr=0.0d0
502       if (with_theta_constr) call etheta_constr(ethetacnstr)
503 C
504 C Calculate the SC local energy.
505 C
506       call vec_and_deriv
507       call esc(escloc)
508 C
509 C Calculate the virtual-bond torsional energy.
510 C
511       if (wtor.gt.0.0d0) then
512          if (tor_mode.eq.0) then
513            call etor(etors)
514          else
515 C etor kcc is Kubo cumulant clustered rigorous attemp to derive the
516 C energy function
517            call etor_kcc(etors)
518          endif
519       else
520         etors=0.0d0
521       endif
522       edihcnstr=0.0d0
523 c Lipid transfer
524       if (wliptran.gt.0) then
525         call Eliptransfer(eliptran)
526       else
527         eliptran=0.0d0
528       endif
529
530       if (ndih_constr.gt.0) call etor_constr(edihcnstr)
531 c      print *,"Processor",myrank," computed Utor"
532 C
533 C 6/23/01 Calculate double-torsional energy
534 C
535       if ((wtor_d.gt.0.0d0).and.(tor_mode.eq.0)) then
536         call etor_d(etors_d)
537       else
538         etors_d=0
539       endif
540 c
541 c Homology restraints
542 c
543       if (constr_homology.ge.1) then
544         call e_modeller(ehomology_constr)
545       else
546         ehomology_constr=0.0d0
547       endif
548 #ifdef DFA
549 C     BARTEK for dfa test!
550       if (wdfa_dist.gt.0) then
551          call edfad(edfadis)
552       else
553          edfadis=0.0
554       endif
555 c      print*, 'edfad is finished!', edfadis
556       if (wdfa_tor.gt.0) then
557          call edfat(edfator)
558       else
559          edfator=0.0
560       endif
561 c      print*, 'edfat is finished!', edfator
562       if (wdfa_nei.gt.0) then
563          call edfan(edfanei)
564       else
565          edfanei=0.0
566       endif
567 c      print*, 'edfan is finished!', edfanei
568       if (wdfa_beta.gt.0) then
569          call edfab(edfabet)
570       else
571          edfabet=0.0
572       endif
573 c      print*, 'edfab is finished!', edfabet
574 #endif
575 C
576 C 21/5/07 Calculate local sicdechain correlation energy
577 C
578       if (wsccor.gt.0.0d0) then
579         call eback_sc_corr(esccor)
580       else
581         esccor=0.0d0
582       endif
583 c      write (iout,*) "nsaxs",nsaxs," saxs_mode",saxs_mode
584       if (nsaxs.gt.0 .and. saxs_mode.eq.0) then
585         call e_saxs(Esaxs_constr)
586 c        write (iout,*) "From Esaxs: Esaxs_constr",Esaxs_constr
587       else if (nsaxs.gt.0 .and. saxs_mode.gt.0) then
588         call e_saxsC(Esaxs_constr)
589 c        write (iout,*) "From EsaxsC: Esaxs_constr",Esaxs_constr
590       else
591         Esaxs_constr = 0.0d0
592       endif
593 C
594 C Put energy components into an array
595 C
596       do i=1,n_ene
597         energia(i)=0.0d0
598       enddo
599       energia(1)=evdw
600 #ifdef SCP14
601       energia(2)=evdw2-evdw2_14
602       energia(18)=evdw2_14
603 #else
604       energia(2)=evdw2
605       energia(18)=0.0d0
606 #endif
607 #ifdef SPLITELE
608       energia(3)=ees
609       energia(16)=evdw1
610 #else
611       energia(3)=ees+evdw1
612       energia(16)=0.0d0
613 #endif
614       energia(4)=ecorr
615       energia(5)=ecorr5
616       energia(6)=ecorr6
617       energia(7)=eel_loc
618       energia(8)=eello_turn3
619       energia(9)=eello_turn4
620       energia(10)=eturn6
621       energia(11)=ebe
622       energia(12)=escloc
623       energia(13)=etors
624       energia(14)=etors_d
625       energia(15)=ehpb
626       energia(17)=estr
627       energia(19)=edihcnstr
628       energia(21)=esccor
629       energia(22)=eliptran
630       energia(24)=ethetacnstr
631       energia(25)=Etube
632       energia(26)=Esaxs_constr
633       energia(27)=ehomology_constr
634       energia(28)=edfadis
635       energia(29)=edfator
636       energia(30)=edfanei
637       energia(31)=edfabet
638 c      write (iout,*) "ETOTAL_SHORT before SUM_ENERGY"
639 c      call flush(iout)
640       call sum_energy(energia,.true.)
641 c      write (iout,*) "Exit ETOTAL_SHORT"
642 c      call flush(iout)
643       return
644       end