5 include "COMMON.INTERACT"
6 include "COMMON.IOUNITS"
7 integer i,ii,ipi,ipj,ipmin,j,jmin,k,ix,iy,iz,
8 & ixmin,iymin,izmin,ir_start,ir_end
9 integer iper(maxchain),iaux
10 double precision dchain,dchainmin,cmchain(3,20)
14 do j=chain_border(1,i),chain_border(2,i)
15 if (itype(j).eq.ntyp1) cycle
18 cmchain(k,i)=cmchain(k,i)+c(k,j)
22 cmchain(k,i)=cmchain(k,i)/ii
36 dchain=(cmchain(1,ipj)-cmchain(1,ipi)+ix*boxxsize)**2+
37 & (cmchain(2,ipj)-cmchain(2,ipi)+iy*boxysize)**2+
38 & (cmchain(3,ipj)-cmchain(3,ipi)+iz*boxzsize)**2
39 c write (iout,*) "i",i," ipi",ipi," j",j," ipj",ipj," d",
40 c & dsqrt(dchain)," dmin",dsqrt(dchainmin)," jmin",jmin
41 if (dchain.lt.dchainmin) then
52 if (ixmin.eq.0 .and. iymin.eq.0 .and. izmin.eq.0) cycle
54 cmchain(1,ipj)=cmchain(1,ipj)+ixmin*boxxsize
55 cmchain(2,ipj)=cmchain(2,ipj)+iymin*boxysize
56 cmchain(3,ipj)=cmchain(3,ipj)+izmin*boxzsize
57 ir_start=chain_border(1,ipj)
58 if (ir_start.gt.1) ir_start=ir_start-1
59 ir_end=chain_border(2,ipj)
60 if (ir_end.lt.nres) ir_end=ir_end+1
62 c(1,k)=c(1,k)+ixmin*boxxsize
63 c(2,k)=c(2,k)+iymin*boxysize
64 c(3,k)=c(3,k)+izmin*boxzsize
65 c(1,k+nres)=c(1,k+nres)+ixmin*boxxsize
66 c(2,k+nres)=c(2,k+nres)+iymin*boxysize
67 c(3,k+nres)=c(3,k+nres)+izmin*boxzsize
69 c write (iout,*) "jmin",jmin," ipj",ipj,
70 c & " ixmin",ixmin," iymin",iymin," izmin",izmin