source: enyshe.f@ 9f146fa

Last change on this file since 9f146fa was 38d77eb, checked in by baerbaer <baerbaer@…>, 15 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
RevLine 
[bd2278d]1! **************************************************************
2!
[32289cd]3! This file contains the subroutines: enyshe
[bd2278d]4!
5! Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
[32289cd]6! Shura Hayryan, Chin-Ku
[bd2278d]7! Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
8! Jan H. Meinke, Sandipan Mohanty
9!
10! **************************************************************
[e40e335]11
12
13 real*8 function enyshe(nml)
14
[bd2278d]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
[32289cd]22! this loop it loops over the van-der-Waals domains of each atom in the
[bd2278d]23! moving set and finally over the atoms that belong to the 1-4 interaction
24! set.
25! ............................................................................
[e40e335]26
27 include 'INCL.H'
28
[bd2278d]29! If nml == 0 calculate the interaction between all pairs.
[32289cd]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
[e40e335]36 if (nml.eq.0) then
37 ntlvr = nvr
38 else
39 ntlvr=nvrml(nml)
40 endif
[32289cd]41
[e40e335]42 if (ntlvr.eq.0) then
[38d77eb]43 write (logString, '(a,i4)')
[bd2278d]44 & ' enyshe> No variables defined in molecule #',nml
[e40e335]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)
[32289cd]56 else
[bd2278d]57! Index of first variable in molecule.
[e40e335]58 ifivr=ivrml1(nml)
[bd2278d]59! Index of last moving set in molecule
[e40e335]60 i1s=imsml1(nml)+nmsml(nml)
61 endif
[32289cd]62! Loop over moving sets/variables in reverse order
63 do io=ifivr+ntlvr-1,ifivr,-1
[bd2278d]64! The array iorvr contains the variables in an "apropriate" order.
[32289cd]65 iv=iorvr(io)
[bd2278d]66! Index of the primary moving atom for the variable with index iv
[32289cd]67 ia=iatvr(iv)
[bd2278d]68! Get the type of variable iv (valence length, valence angle, dihedral angle)
[32289cd]69 it=ityvr(iv)
[bd2278d]70! Class of variable iv's potential (Q: What are they)
[32289cd]71 ic=iclvr(iv)
[bd2278d]72! If iv is a dihedral angle ...
[32289cd]73 if (it.eq.3) then
[bd2278d]74! Barrier height * 1/2 of the potential of iv.
[e40e335]75 e0=e0to(ic)
[bd2278d]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.
[32289cd]78 if (e0.ne.0.)
[bd2278d]79 & eyvr=eyvr+e0*(1.0+sgto(ic)*cos(toat(ia)*rnto(ic)))
80! else if iv is a valence angle ...
[32289cd]81 elseif (it.eq.2) then
[bd2278d]82! vr is the valence angle of ia
[e40e335]83 vr=baat(ia)
[bd2278d]84! else if iv is a valence length...
[32289cd]85 elseif (it.eq.1) then
[bd2278d]86! vr is the length of the valence bond
[e40e335]87 vr=blat(ia)
88 endif
89
[bd2278d]90! ============================================ Energies & Atomic forces
91! index of next to last moving set
[e40e335]92 i2s=i1s-1
[bd2278d]93! index of first moving set associated with iv
[32289cd]94 i1s=imsvr1(iv)
[bd2278d]95! Loop over all moving sets starting from the one associated with vr to the end.
[32289cd]96 do ims=i1s,i2s
[bd2278d]97! First atom of the current moving set
[e40e335]98 i1=latms1(ims)
[bd2278d]99! Last atom of the current moving set
[e40e335]100 i2=latms2(ims)
[bd2278d]101! Loop over all atoms of the current moving set.
[32289cd]102 do i=i1,i2
[bd2278d]103! Atom class of current atom
[e40e335]104 ity=ityat(i)
[bd2278d]105! Point charge at current atom
[e40e335]106 cqi=conv*cgat(i)
[bd2278d]107! Cartesian coordinates of current atom
[e40e335]108 xi=xat(i)
109 yi=yat(i)
110 zi=zat(i)
[bd2278d]111! Loop over the atoms of the van der Waals domain belonging to atom i
[32289cd]112 do ivw=ivwat1(i),ivwat2(i)
113! Loop over the atoms of the van der Waals domain of the atoms of the
[bd2278d]114! van der Waals domain of atom i
115! Q: Which atoms are in these domains?
[32289cd]116 do j=lvwat1(ivw),lvwat2(ivw)
[bd2278d]117! Atom type of partner
[e40e335]118 jty=ityat(j)
[bd2278d]119! Differences in cartesian coordinates
[e40e335]120 xij=xat(j)-xi
121 yij=yat(j)-yi
122 zij=zat(j)-zi
[bd2278d]123! Cartesian distance and higher powers
[e40e335]124 rij2=xij*xij+yij*yij+zij*zij
125 rij4=rij2*rij2
126 rij6=rij4*rij2
127 rij=sqrt(rij2)
[bd2278d]128! Are we using a distance dependent dielectric constant?
[e40e335]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
[bd2278d]135! Coulomb interaction
[e40e335]136 eyel=eyel+cqi*cgat(j)/(rij*ep)
[bd2278d]137! If the two atoms cannot form a hydrogen bond use 6-12 Lennard-Jones potential
[e40e335]138 if (ihbty(ity,jty).eq.0) then
139 eyvw=eyvw+aij(ity,jty)/(rij6*rij6)
[bd2278d]140 & -cij(ity,jty)/rij6
[e40e335]141 else
[bd2278d]142! For hydrogen bonding use 10-12 Lennard-Jones potential
[e40e335]143 eyhb=eyhb+ahb(ity,jty)/(rij6*rij6)
[bd2278d]144 & -chb(ity,jty)/(rij6*rij4)
[e40e335]145 endif
146
[32289cd]147 enddo
148 enddo
149
[bd2278d]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.
[32289cd]153 do i14=i14at1(i),i14at2(i)
[e40e335]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)
[bd2278d]165! Are we using a distance dependent dielectric constant?
[e40e335]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)
[bd2278d]174! If hydrogen bonding is not possible use 6-12 Lennard-Jones potential.
[e40e335]175 if (ihbty(ity,jty).eq.0) then
176 eyvw=eyvw+a14(ity,jty)/(rij6*rij6)
[bd2278d]177 & -cij(ity,jty)/rij6
[e40e335]178 else
[bd2278d]179! Use 10-12 Lennard-Jones potential for hydrogen bonds.
[e40e335]180 eyhb=eyhb+ahb(ity,jty)/(rij6*rij6)
[bd2278d]181 & -chb(ity,jty)/(rij6*rij4)
[e40e335]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.