source: enyshe.f

Last change on this file was 3fbbfbb, checked in by Jan Meinke <j.meinke@…>, 14 years ago

Move to doxygen comments and smmp_p.

Doxygen comments in Fortran are !> ... !! ... !<. I'm planning move the API documentation from the
lyx file into the code. This should make it easier to get documentation for all the common block
variables as well.

Use import smmp_p to indicate the parallel version of the Python bindings.

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