2 c------------------------------------------------------------------------
3 double precision function boxshift(x,boxsize)
5 double precision x,boxsize
8 if (dabs(xtemp-boxsize).lt.dabs(xtemp)) then
10 else if (dabs(xtemp+boxsize).lt.dabs(xtemp)) then
11 boxshift=xtemp+boxsize
17 c--------------------------------------------------------------------------
18 subroutine closest_img(xi,yi,zi,xj,yj,zj)
20 include 'COMMON.CHAIN'
21 integer xshift,yshift,zshift,subchap
22 double precision dist_init,xj_safe,yj_safe,zj_safe,
23 & xj_temp,yj_temp,zj_temp,dist_temp
27 dist_init=(xj-xi)**2+(yj-yi)**2+(zj-zi)**2
32 xj=xj_safe+xshift*boxxsize
33 yj=yj_safe+yshift*boxysize
34 zj=zj_safe+zshift*boxzsize
35 dist_temp=(xj-xi)**2+(yj-yi)**2+(zj-zi)**2
36 if(dist_temp.lt.dist_init) then
46 if (subchap.eq.1) then
57 c--------------------------------------------------------------------------
58 subroutine to_box(xi,yi,zi)
61 include 'COMMON.CHAIN'
62 double precision xi,yi,zi
64 if (xi.lt.0.0d0) xi=xi+boxxsize
66 if (yi.lt.0.0d0) yi=yi+boxysize
68 if (zi.lt.0.0d0) zi=zi+boxzsize
71 c--------------------------------------------------------------------------
72 subroutine lipid_layer(xi,yi,zi,sslipi,ssgradlipi)
75 include 'COMMON.CHAIN'
76 double precision xi,yi,zi,sslipi,ssgradlipi
77 double precision fracinbuf
78 double precision sscalelip,sscagradlip
80 if ((zi.gt.bordlipbot).and.(zi.lt.bordliptop)) then
81 C the energy transfer exist
82 if (zi.lt.buflipbot) then
83 C what fraction I am in
84 fracinbuf=1.0d0-((zi-bordlipbot)/lipbufthick)
85 C lipbufthick is thickenes of lipid buffore
86 sslipi=sscalelip(fracinbuf)
87 ssgradlipi=-sscagradlip(fracinbuf)/lipbufthick
88 elseif (zi.gt.bufliptop) then
89 fracinbuf=1.0d0-((bordliptop-zi)/lipbufthick)
90 sslipi=sscalelip(fracinbuf)
91 ssgradlipi=sscagradlip(fracinbuf)/lipbufthick