source: energy.f

Last change on this file was 32289cd, checked in by baerbaer <baerbaer@…>, 14 years ago

Explicitly declare variables.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/smmp/trunk@33 26dc1dd8-5c4e-0410-9ffe-d298b4865968

  • Property mode set to 100644
File size: 4.6 KB
RevLine 
[078aff3]1! **************************************************************
2!
3! This file contains the subroutines: energy, enyinternal
4!
5! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
[32289cd]6! Shura Hayryan, Chin-Ku
[078aff3]7! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
8! Jan H. Meinke, Sandipan Mohanty
9!
10! **************************************************************
[e40e335]11
12 real*8 function energy()
[078aff3]13! ------------------------------------------
14! PURPOSE: calculate the *total* energy of the system
15!
16! ientyp = 0 for ECEPP3, 1 for FLEX, 2 for Lund
17! 3 for ECEPP3 with Abagyan corrections
18!
19! CALLS: enyflx,enyreg,enyshe,enysol,esolan,setvar, eninteract
20!
21! -------------------------------------------------
[e40e335]22
23 include 'INCL.H'
[32289cd]24 double precision esm, teysl, enyshe, enyflx, enylun, enyreg
25 double precision enysol, esolan, exvlun, eyabgn, eninteract
26
27 integer i
28
[e40e335]29 double precision teysm, teyel, teyvw, teyhb, teyvr
[32289cd]30! print *,'energy function with ientyp = ',ientyp
[e40e335]31 esm = 0.d0
32 teysm = 0.d0
33 teyel = 0.d0
34 teyvw = 0.d0
35 teyhb = 0.d0
36 teyvr = 0.d0
37 teysl = 0.d0
38
[32289cd]39 do i = 1,ntlml
[e40e335]40 eysm=0
41 eyel=0
42 eyvr=0
43 eyhb=0
44 eyvw=0
45 eysl=0
46
47 call setvar(i,vlvr) ! set variables & rebuild
48
49 if (ientyp.eq.0.or.ientyp.eq.3) then
50 esm=esm+enyshe(i)
[32289cd]51 else if (ientyp.eq.1) then
[fafe4d6]52 esm=esm+enyflx(i)
[e40e335]53 else if (ientyp.eq.2) then
54 esm=enylun(i)
55 endif
56
57 teysm = teysm + eysm
58 teyel = teyel + eyel
59 teyhb = teyhb + eyhb
60 teyvr = teyvr + eyvr
61 if (ientyp.eq.2) then
[078aff3]62! The Lund term stores the hydrophobicity energy in eysl
[e40e335]63 teysl = teysl + eysl
[32289cd]64 else
[078aff3]65! .. and the excluded volume term in eyvw, which is calculated once.
[e40e335]66 teyvw = teyvw + eyvw
67 endif
68
[32289cd]69 if (ireg.eq.1) eyrg=enyreg(i)
[e40e335]70
71 enddo
72
[32289cd]73 if (ientyp.ne.2) then
74! Don't touch eysl if using Lund potential, as enylun stores
[078aff3]75! its hydrophobicity term there.
[e40e335]76 if (itysol.gt.0) then
77 esm=esm+enysol(0)
78 teysl = teysl+eysl
[b477fe8]79 else if (itysol.lt.0) then
80 eysl = esolan(0)
81 teysl = teysl + eysl
82 esm = esm + eysl
[e40e335]83 else
84 eysl=0.d0
85 endif
[32289cd]86 else
[078aff3]87! Add excluded volume term and save it in eyvw
[e40e335]88 esm=esm+exvlun(0)
89 teyvw = teyvw+eyvw
90 endif
91
[32289cd]92! The Abagyan entropic corrections depend on the area exposed to the
[078aff3]93! solvent for each residue. So, this term has to be evaluated after the
94! solvent term.
[e40e335]95 eyab=0.0
96 if (ientyp.eq.3) then
[32289cd]97 do i = 1,ntlml
[e40e335]98 eyab=eyab+eyabgn(i)
99 enddo
100 endif
101 esm=esm+eyab
[078aff3]102! Partial energies for the entire system. If you need the partial
103! energies for a single molecule call enyinternal.
[e40e335]104 eysm = teysm
105 eyel = teyel
106 eyvw = teyvw
107 eyhb = teyhb
108 eyvr = teyvr
109 eysl = teysl
[32289cd]110
[e40e335]111 if (ientyp.ne.2) then
[078aff3]112! This is temporary. eninteract() does not yet know how to calculate
113! interactions using the Lund potential.
[e40e335]114 energy = esm + eninteract()
115 return
116 endif
117 energy=esm
118 return
119 end
120
[078aff3]121!c Calculates the internal energy for a single molecule.
122! All the partial energies are thus set to their values for molecule
[32289cd]123! nml.
[078aff3]124!
125! @param nml the ID of the molecule
126! @return internal energy of a single molecule
127!
128! @author Jan H. Meinke <j.meinke@fz-juelich.de>
[e40e335]129 real*8 function enyinternal(nml)
130
[078aff3]131!f2py intent(in) nml
[32289cd]132
[e40e335]133 include 'INCL.H'
[32289cd]134 double precision esm, enyshe, enyflx, enylun, enyreg, enysol
135 double precision esolan, exvlun, eyabgn
136
137 integer nml, i
138
[e40e335]139 esm = 0.d0
140
[32289cd]141 call setvar(nml,vlvr)
[e40e335]142
143 if (ientyp.eq.0.or.ientyp.eq.3) then
144 esm=esm+enyshe(nml)
145 else if (ientyp.eq.1) then
146 esm=esm+enyflx(nml)
147 else if (ientyp.eq.2) then
148 esm=esm+enylun(nml)
149 endif
150
151 if (ireg.eq.1) eyrg=enyreg(nml)
152
153 if (ientyp.ne.2) then
154 if (itysol.gt.0) then
155 esm=esm+enysol(nml)
[078aff3]156 elseif (itysol.lt.0) then
[b477fe8]157 esm=esm+esolan(nml)
[e40e335]158 else
159 eysl=0.d0
160 endif
[32289cd]161 else
[e40e335]162 esm=esm+exvlun(nml)
163 endif
[32289cd]164! The Abagyan entropic corrections depend on the area exposed to the
[078aff3]165! solvent for each residue. So, this term has to be evaluated after the
166! solvent term.
[e40e335]167 eyab=0.0
168 if (ientyp.eq.3) then
169 do i=1,ntlml
170 eyab=eyab + eyabgn(i)
171 enddo
172 endif
173 esm=esm+eyab
174
175 enyinternal = esm
176 return
177 end
Note: See TracBrowser for help on using the repository browser.