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