3 C Build the virtual polypeptide chain. Side-chain centroids are moveable.
6 implicit real*8 (a-h,o-z)
12 include 'COMMON.IOUNITS'
13 include 'COMMON.NAMES'
14 include 'COMMON.INTERACT'
15 double precision e1(3),e2(3),e3(3)
16 logical lprn,perbox,fail
17 C Set lprn=.true. for debugging
26 C first three CAs and SC(2).
28 subroutine chainbuild_extconf
30 C Build the virtual polypeptide chain. Side-chain centroids are moveable.
33 implicit real*8 (a-h,o-z)
35 include 'COMMON.CHAIN'
36 include 'COMMON.LOCAL'
39 include 'COMMON.IOUNITS'
40 include 'COMMON.NAMES'
41 include 'COMMON.INTERACT'
42 double precision e1(3),e2(3),e3(3)
43 logical lprn,perbox,fail
45 c write (iout,*) "Calling chainbuild_extconf"
48 * Build the alpha-carbon chain.
51 call locate_next_res(i)
54 C First and last SC must coincide with the corresponding CA.
58 dc_norm(j,nres+1)=0.0D0
60 dc_norm(j,nres+nres)=0.0D0
62 c(j,nres+nres)=c(j,nres)
70 write (iout,'(/a)') 'Recalculated internal coordinates'
73 c(j,maxres2)=0.5D0*(c(j,i-1)+c(j,i+1))
76 if (i.gt.3) be=rad2deg*beta(i-3,i-2,i-1,i)
77 be1=rad2deg*beta(nres+i,i,maxres2,i+1)
79 if (i.gt.2) alfai=rad2deg*alpha(i-2,i-1,i)
80 write (iout,1212) restyp(itype(i)),i,dist(i-1,i),
81 & alfai,be,dist(nres+i,i),rad2deg*alpha(nres+i,i,maxres2),be1
83 1212 format (a3,'(',i3,')',2(f10.5,2f10.2))
90 c-------------------------------------------------------------------------
93 C Define the origin and orientation of the coordinate system and locate
94 C the first three atoms.
96 implicit real*8 (a-h,o-z)
98 include 'COMMON.CHAIN'
99 include 'COMMON.LOCAL'
153 dc_norm(j,2)=prod(j,1,2)
154 dc(j,2)=vbld(3)*prod(j,1,2)
155 c(j,3)=c(j,2)+dc(j,2)
157 call locate_side_chain(2)
160 c-----------------------------------------------------------------------------
161 subroutine locate_next_res(i)
163 C Locate CA(i) and SC(i-1)
165 implicit real*8 (a-h,o-z)
167 include 'COMMON.CHAIN'
168 include 'COMMON.LOCAL'
171 include 'COMMON.IOUNITS'
172 include 'COMMON.NAMES'
173 include 'COMMON.INTERACT'
175 C Define the rotation matrices corresponding to CA(i)
179 if (theti.ne.theti) theti=100.0
181 if (phii.ne.phii) phii=180.0
190 * Define the matrices of the rotation about the virtual-bond valence angles
191 * theta, T(i,j,k), virtual-bond dihedral angles gamma (miscalled PHI in this
192 * program), R(i,j,k), and, the cumulative matrices of rotation RT
214 rt(2,1,i-2)=sint*cosphi
215 rt(2,2,i-2)=-cost*cosphi
217 rt(3,1,i-2)=-sint*sinphi
218 rt(3,2,i-2)=cost*sinphi
220 call matmult(prod(1,1,i-2),rt(1,1,i-2),prod(1,1,i-1))
222 dc_norm(j,i-1)=prod(j,1,i-1)
223 dc(j,i-1)=vbld(i)*prod(j,1,i-1)
224 c(j,i)=c(j,i-1)+dc(j,i-1)
226 cd print '(2i3,2(3f10.5,5x))', i-1,i,(dc(j,i-1),j=1,3),(c(j,i),j=1,3)
228 C Now calculate the coordinates of SC(i-1)
230 call locate_side_chain(i-1)
233 c-----------------------------------------------------------------------------
234 subroutine locate_side_chain(i)
236 C Locate the side-chain centroid i, 1 < i < NRES. Put in C(*,NRES+i).
238 implicit real*8 (a-h,o-z)
240 include 'COMMON.CHAIN'
241 include 'COMMON.LOCAL'
244 include 'COMMON.IOUNITS'
245 include 'COMMON.NAMES'
246 include 'COMMON.INTERACT'
250 c dsci_inv=dsc_inv(itype(i))
252 dsci_inv=vbld_inv(i+nres)
256 if (alphi.ne.alphi) alphi=100.0
257 if (omegi.ne.omegi) omegi=-100.0
267 yp= dsci*sinalphi*cosomegi
268 zp=-dsci*sinalphi*sinomegi
269 * Now we have to rotate the coordinate system by 180-theta(i)/2 so as to get its
270 * X-axis aligned with the vector DC(*,i)
271 theta2=pi-0.5D0*theta(i+1)
274 xx(1)= xp*cost2+yp*sint2
275 xx(2)=-xp*sint2+yp*cost2
277 cd print '(a3,i3,3f10.5,5x,3f10.5)',restyp(itype(i)),i,
278 cd & xp,yp,zp,(xx(k),k=1,3)
282 * Bring the SC vectors to the common coordinate system.
284 xx(2)=xloc(2,i)*r(2,2,i-1)+xloc(3,i)*r(2,3,i-1)
285 xx(3)=xloc(2,i)*r(3,2,i-1)+xloc(3,i)*r(3,3,i-1)
292 rj=rj+prod(j,k,i-1)*xx(k)
295 dc_norm(j,nres+i)=rj*dsci_inv
296 c(j,nres+i)=c(j,i)+rj
300 c------------------------------------------
307 include 'COMMON.CONTROL'
311 include 'COMMON.LANGEVIN'
313 include 'COMMON.LANGEVIN.lang0'
315 include 'COMMON.CHAIN'
316 include 'COMMON.DERIV'
318 include 'COMMON.LOCAL'
319 include 'COMMON.INTERACT'
320 include 'COMMON.IOUNITS'
321 include 'COMMON.NAMES'
322 include 'COMMON.TIME1'
323 include 'COMMON.REMD'
324 include 'COMMON.SETUP'
325 include 'COMMON.MUCA'
326 include 'COMMON.HAIRPIN'
327 C change suggested by Ana - begin
328 integer allareout,chain_beg,chain_end,i,j,k
329 integer ireturnval,nojumpval
330 double precision difference
331 C change suggested by Ana - end
335 C write(*,*) 'initial', i,j,c(j,i)
337 C change suggested by Ana - begin
339 C change suggested by Ana -end
341 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
343 if (allareout.eq.1) then
344 ireturnval=int(c(j,i)/boxxsize)
345 if (c(j,i).le.0) ireturnval=ireturnval-1
346 do k=chain_beg,chain_end
347 c(j,k)=c(j,k)-ireturnval*boxxsize
348 c(j,k+nres)=c(j,k+nres)-ireturnval*boxxsize
352 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
353 C Suggested by Ana -end
358 if (int(c(j,i)/boxxsize).eq.0) allareout=0
361 if (allareout.eq.1) then
362 ireturnval=int(c(j,i)/boxxsize)
363 if (c(j,i).le.0) ireturnval=ireturnval-1
365 c(j,k)=c(j,k)-ireturnval*boxxsize
366 c(j,k+nres)=c(j,k+nres)-ireturnval*boxxsize
371 C write(*,*) 'befor no jump', i,j,c(j,i)
375 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
376 difference=abs(c(j,i-1)-c(j,i))
377 C print *,'diff', difference
378 if (difference.gt.boxxsize/2.0) then
379 if (c(j,i-1).gt.c(j,i)) then
388 c(j,i)=c(j,i)+nojumpval*boxxsize
389 c(j,i+nres)=c(j,i+nres)+nojumpval*boxxsize
393 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
394 difference=abs(c(j,i-1)-c(j,i))
395 if (difference.gt.boxxsize/2.0) then
396 if (c(j,i-1).gt.c(j,i)) then
405 c(j,i)=c(j,i)+nojumpval*boxxsize
406 c(j,i+nres)=c(j,i+nres)+nojumpval*boxxsize
410 C write(*,*) 'after no jump', i,j,c(j,i)
414 C suggesed by Ana begins
416 C suggested by Ana ends
420 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
422 if (allareout.eq.1) then
423 ireturnval=int(c(j,i)/boxysize)
424 if (c(j,i).le.0) ireturnval=ireturnval-1
425 do k=chain_beg,chain_end
426 c(j,k)=c(j,k)-ireturnval*boxysize
427 c(j,k+nres)=c(j,k+nres)-ireturnval*boxysize
431 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
432 C Suggested by Ana -end
437 if (int(c(j,i)/boxysize).eq.0) allareout=0
440 if (allareout.eq.1) then
441 ireturnval=int(c(j,i)/boxysize)
442 if (c(j,i).le.0) ireturnval=ireturnval-1
444 c(j,k)=c(j,k)-ireturnval*boxysize
445 c(j,k+nres)=c(j,k+nres)-ireturnval*boxysize
450 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
451 difference=abs(c(j,i-1)-c(j,i))
452 if (difference.gt.boxysize/2.0) then
453 if (c(j,i-1).gt.c(j,i)) then
462 c(j,i)=c(j,i)+nojumpval*boxysize
463 c(j,i+nres)=c(j,i+nres)+nojumpval*boxysize
467 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
468 difference=abs(c(j,i-1)-c(j,i))
469 if (difference.gt.boxysize/2.0) then
470 if (c(j,i-1).gt.c(j,i)) then
479 c(j,i)=c(j,i)+nojumpval*boxysize
480 c(j,i+nres)=c(j,i+nres)+nojumpval*boxysize
483 C Suggested by Ana -begins
485 C Suggested by Ana -ends
489 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
491 if (allareout.eq.1) then
492 ireturnval=int(c(j,i)/boxysize)
493 if (c(j,i).le.0) ireturnval=ireturnval-1
494 do k=chain_beg,chain_end
495 c(j,k)=c(j,k)-ireturnval*boxzsize
496 c(j,k+nres)=c(j,k+nres)-ireturnval*boxzsize
500 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
501 C Suggested by Ana -end
506 if (int(c(j,i)/boxzsize).eq.0) allareout=0
509 if (allareout.eq.1) then
510 ireturnval=int(c(j,i)/boxzsize)
511 if (c(j,i).le.0) ireturnval=ireturnval-1
513 c(j,k)=c(j,k)-ireturnval*boxzsize
514 c(j,k+nres)=c(j,k+nres)-ireturnval*boxzsize
519 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
520 difference=abs(c(j,i-1)-c(j,i))
521 if (difference.gt.(boxzsize/2.0)) then
522 if (c(j,i-1).gt.c(j,i)) then
531 c(j,i)=c(j,i)+nojumpval*boxzsize
532 c(j,i+nres)=c(j,i+nres)+nojumpval*boxzsize
536 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
537 difference=abs(c(j,i-1)-c(j,i))
538 if (difference.gt.boxzsize/2.0) then
539 if (c(j,i-1).gt.c(j,i)) then
548 c(j,i)=c(j,i)+nojumpval*boxzsize
549 c(j,i+nres)=c(j,i+nres)+nojumpval*boxzsize