source: enyshe.f@ 9f146fa

Last change on this file since 9f146fa was 38d77eb, checked in by baerbaer <baerbaer@…>, 14 years ago

Redirected standard out to logString.

SMMP produced a lot of log messages. This became an issue when run in massively
parallel environments. I replaced all writes to standard out to a write to logString.
The next step is to pass this string to a function that writes the messages to a log
file according to their importance and the chosen log level.

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

  • Property mode set to 100644
File size: 6.3 KB
Line 
1! **************************************************************
2!
3! This file contains the subroutines: enyshe
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! **************************************************************
11
12
13 real*8 function enyshe(nml)
14
15! ............................................................................
16!
17! PURPOSE: Calculate internal energy of molecule 'nml' with ECEPP parameters
18!
19! CALLS: none
20!
21! The function loops over all moving sets within the molecule. Within
22! this loop it loops over the van-der-Waals domains of each atom in the
23! moving set and finally over the atoms that belong to the 1-4 interaction
24! set.
25! ............................................................................
26
27 include 'INCL.H'
28
29! If nml == 0 calculate the interaction between all pairs.
30 double precision e0, vr, cqi, xi, yi, zi, xij, yij, zij, rij2
31 double precision rij4, rij6, rij, sr, ep
32
33 integer nml, ntlvr, ifivr, i1s, io, iv, ia, it, ic, i2s, ims, i1
34 integer i2, i, ity, ivw, j, jty, i14
35
36 if (nml.eq.0) then
37 ntlvr = nvr
38 else
39 ntlvr=nvrml(nml)
40 endif
41
42 if (ntlvr.eq.0) then
43 write (logString, '(a,i4)')
44 & ' enyshe> No variables defined in molecule #',nml
45 return
46 endif
47
48 enyshe=0.0
49 eyel=0.0
50 eyvw=0.0
51 eyhb=0.0
52 eyvr=0.0
53 if (nml.eq.0) then
54 ifivr = ivrml1(1)
55 i1s = imsml1(ntlml) + nmsml(ntlml)
56 else
57! Index of first variable in molecule.
58 ifivr=ivrml1(nml)
59! Index of last moving set in molecule
60 i1s=imsml1(nml)+nmsml(nml)
61 endif
62! Loop over moving sets/variables in reverse order
63 do io=ifivr+ntlvr-1,ifivr,-1
64! The array iorvr contains the variables in an "apropriate" order.
65 iv=iorvr(io)
66! Index of the primary moving atom for the variable with index iv
67 ia=iatvr(iv)
68! Get the type of variable iv (valence length, valence angle, dihedral angle)
69 it=ityvr(iv)
70! Class of variable iv's potential (Q: What are they)
71 ic=iclvr(iv)
72! If iv is a dihedral angle ...
73 if (it.eq.3) then
74! Barrier height * 1/2 of the potential of iv.
75 e0=e0to(ic)
76! Calculate the periodic potential term. sgto is the sign of the barrier, rnto is
77! the periodicity and toat is torsion angle(?) associate with atom ia.
78 if (e0.ne.0.)
79 & eyvr=eyvr+e0*(1.0+sgto(ic)*cos(toat(ia)*rnto(ic)))
80! else if iv is a valence angle ...
81 elseif (it.eq.2) then
82! vr is the valence angle of ia
83 vr=baat(ia)
84! else if iv is a valence length...
85 elseif (it.eq.1) then
86! vr is the length of the valence bond
87 vr=blat(ia)
88 endif
89
90! ============================================ Energies & Atomic forces
91! index of next to last moving set
92 i2s=i1s-1
93! index of first moving set associated with iv
94 i1s=imsvr1(iv)
95! Loop over all moving sets starting from the one associated with vr to the end.
96 do ims=i1s,i2s
97! First atom of the current moving set
98 i1=latms1(ims)
99! Last atom of the current moving set
100 i2=latms2(ims)
101! Loop over all atoms of the current moving set.
102 do i=i1,i2
103! Atom class of current atom
104 ity=ityat(i)
105! Point charge at current atom
106 cqi=conv*cgat(i)
107! Cartesian coordinates of current atom
108 xi=xat(i)
109 yi=yat(i)
110 zi=zat(i)
111! Loop over the atoms of the van der Waals domain belonging to atom i
112 do ivw=ivwat1(i),ivwat2(i)
113! Loop over the atoms of the van der Waals domain of the atoms of the
114! van der Waals domain of atom i
115! Q: Which atoms are in these domains?
116 do j=lvwat1(ivw),lvwat2(ivw)
117! Atom type of partner
118 jty=ityat(j)
119! Differences in cartesian coordinates
120 xij=xat(j)-xi
121 yij=yat(j)-yi
122 zij=zat(j)-zi
123! Cartesian distance and higher powers
124 rij2=xij*xij+yij*yij+zij*zij
125 rij4=rij2*rij2
126 rij6=rij4*rij2
127 rij=sqrt(rij2)
128! Are we using a distance dependent dielectric constant?
129 if(epsd) then
130 sr=slp*rij
131 ep=plt-(sr*sr+2.0*sr+2.0)*(plt-1.0)*exp(-sr)/2.0
132 else
133 ep = 1.0d0
134 end if
135! Coulomb interaction
136 eyel=eyel+cqi*cgat(j)/(rij*ep)
137! If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
138 if (ihbty(ity,jty).eq.0) then
139 eyvw=eyvw+aij(ity,jty)/(rij6*rij6)
140 & -cij(ity,jty)/rij6
141 else
142! For hydrogen bonding use 10-12 Lennard-Jones potential
143 eyhb=eyhb+ahb(ity,jty)/(rij6*rij6)
144 & -chb(ity,jty)/(rij6*rij4)
145 endif
146
147 enddo
148 enddo
149
150! Loop over 1-4 interaction partners
151! The interactions between atoms that are three bonds apart in the protein are
152! dominated by quantum mechanical effects. They are treated separately.
153 do i14=i14at1(i),i14at2(i)
154 j=l14at(i14)
155
156 jty=ityat(j)
157
158 xij=xat(j)-xi
159 yij=yat(j)-yi
160 zij=zat(j)-zi
161 rij2=xij*xij+yij*yij+zij*zij
162 rij4=rij2*rij2
163 rij6=rij4*rij2
164 rij = sqrt(rij2)
165! Are we using a distance dependent dielectric constant?
166 if(epsd) then
167 sr=slp*rij
168 ep=plt-(sr*sr+2.0*sr+2.0)*(plt-1.0)*exp(-sr)/2.0
169 else
170 ep=1.0d0
171 end if
172
173 eyel=eyel+cqi*cgat(j)/(rij*ep)
174! If hydrogen bonding is not possible use 6-12 Lennard-Jones potential.
175 if (ihbty(ity,jty).eq.0) then
176 eyvw=eyvw+a14(ity,jty)/(rij6*rij6)
177 & -cij(ity,jty)/rij6
178 else
179! Use 10-12 Lennard-Jones potential for hydrogen bonds.
180 eyhb=eyhb+ahb(ity,jty)/(rij6*rij6)
181 & -chb(ity,jty)/(rij6*rij4)
182 endif
183
184 enddo ! ... 1-4-partners of i
185
186 enddo ! ... atoms i
187 enddo ! ... m.s.
188
189 enddo ! ... variables
190
191 eysm = eyel + eyvw + eyhb + eyvr
192
193 enyshe=eysm
194 return
195 end
196
Note: See TracBrowser for help on using the repository browser.