source: energy.f@ 6650a56

Last change on this file since 6650a56 was fafe4d6, checked in by baerbaer <baerbaer@…>, 16 years ago

Call enyflx() in energy() if ientyp is 1.

The function energy() called enyshe even if flex potential had been chosen by
setting ientyp=1. Now setting ientyp=1 causes energy() to call enyflx() as it
should.

Thanks to Christoph Honisch for reporting this bug.

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

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