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
21 print *, 'enter chainbuild'
27 C first three CA's and SC(2).
29 subroutine chainbuild_extconf
31 C Build the virtual polypeptide chain. Side-chain centroids are moveable.
34 implicit real*8 (a-h,o-z)
36 include 'COMMON.CHAIN'
37 include 'COMMON.LOCAL'
40 include 'COMMON.IOUNITS'
41 include 'COMMON.NAMES'
42 include 'COMMON.INTERACT'
43 double precision e1(3),e2(3),e3(3)
44 logical lprn,perbox,fail
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------------------------------------------
306 include 'COMMON.CONTROL'
310 include 'COMMON.LANGEVIN'
312 include 'COMMON.LANGEVIN.lang0'
314 include 'COMMON.CHAIN'
315 include 'COMMON.DERIV'
317 include 'COMMON.LOCAL'
318 include 'COMMON.INTERACT'
319 include 'COMMON.IOUNITS'
320 include 'COMMON.NAMES'
321 include 'COMMON.TIME1'
322 include 'COMMON.REMD'
323 include 'COMMON.SETUP'
324 include 'COMMON.MUCA'
325 include 'COMMON.HAIRPIN'
326 C change suggested by Ana - begin
328 C change suggested by Ana - end
332 C write(*,*) 'initial', i,j,c(j,i)
334 C change suggested by Ana - begin
336 C change suggested by Ana -end
338 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
340 if (allareout.eq.1) then
341 ireturnval=int(c(j,i)/boxxsize)
342 if (c(j,i).le.0) ireturnval=ireturnval-1
343 do k=chain_beg,chain_end
344 c(j,k)=c(j,k)-ireturnval*boxxsize
345 c(j,k+nres)=c(j,k+nres)-ireturnval*boxxsize
349 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
350 C Suggested by Ana -end
355 if (int(c(j,i)/boxxsize).eq.0) allareout=0
358 if (allareout.eq.1) then
359 ireturnval=int(c(j,i)/boxxsize)
360 if (c(j,i).le.0) ireturnval=ireturnval-1
362 c(j,k)=c(j,k)-ireturnval*boxxsize
363 c(j,k+nres)=c(j,k+nres)-ireturnval*boxxsize
368 C write(*,*) 'befor no jump', i,j,c(j,i)
372 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
373 difference=abs(c(j,i-1)-c(j,i))
374 C print *,'diff', difference
375 if (difference.gt.boxxsize/2.0) then
376 if (c(j,i-1).gt.c(j,i)) then
385 c(j,i)=c(j,i)+nojumpval*boxxsize
386 c(j,i+nres)=c(j,i+nres)+nojumpval*boxxsize
390 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
391 difference=abs(c(j,i-1)-c(j,i))
392 if (difference.gt.boxxsize/2.0) then
393 if (c(j,i-1).gt.c(j,i)) then
402 c(j,i)=c(j,i)+nojumpval*boxxsize
403 c(j,i+nres)=c(j,i+nres)+nojumpval*boxxsize
407 C write(*,*) 'after no jump', i,j,c(j,i)
411 C suggesed by Ana begins
413 C suggested by Ana ends
417 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
419 if (allareout.eq.1) then
420 ireturnval=int(c(j,i)/boxysize)
421 if (c(j,i).le.0) ireturnval=ireturnval-1
422 do k=chain_beg,chain_end
423 c(j,k)=c(j,k)-ireturnval*boxysize
424 c(j,k+nres)=c(j,k+nres)-ireturnval*boxysize
428 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
429 C Suggested by Ana -end
434 if (int(c(j,i)/boxysize).eq.0) allareout=0
437 if (allareout.eq.1) then
438 ireturnval=int(c(j,i)/boxysize)
439 if (c(j,i).le.0) ireturnval=ireturnval-1
441 c(j,k)=c(j,k)-ireturnval*boxysize
442 c(j,k+nres)=c(j,k+nres)-ireturnval*boxysize
447 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
448 difference=abs(c(j,i-1)-c(j,i))
449 if (difference.gt.boxysize/2.0) then
450 if (c(j,i-1).gt.c(j,i)) then
459 c(j,i)=c(j,i)+nojumpval*boxysize
460 c(j,i+nres)=c(j,i+nres)+nojumpval*boxysize
464 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
465 difference=abs(c(j,i-1)-c(j,i))
466 if (difference.gt.boxysize/2.0) then
467 if (c(j,i-1).gt.c(j,i)) then
476 c(j,i)=c(j,i)+nojumpval*boxysize
477 c(j,i+nres)=c(j,i+nres)+nojumpval*boxysize
480 C Suggested by Ana -begins
482 C Suggested by Ana -ends
486 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
488 if (allareout.eq.1) then
489 ireturnval=int(c(j,i)/boxysize)
490 if (c(j,i).le.0) ireturnval=ireturnval-1
491 do k=chain_beg,chain_end
492 c(j,k)=c(j,k)-ireturnval*boxzsize
493 c(j,k+nres)=c(j,k+nres)-ireturnval*boxzsize
497 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
498 C Suggested by Ana -end
503 if (int(c(j,i)/boxzsize).eq.0) allareout=0
506 if (allareout.eq.1) then
507 ireturnval=int(c(j,i)/boxzsize)
508 if (c(j,i).le.0) ireturnval=ireturnval-1
510 c(j,k)=c(j,k)-ireturnval*boxzsize
511 c(j,k+nres)=c(j,k+nres)-ireturnval*boxzsize
516 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
517 difference=abs(c(j,i-1)-c(j,i))
518 if (difference.gt.(boxzsize/2.0)) then
519 if (c(j,i-1).gt.c(j,i)) then
528 c(j,i)=c(j,i)+nojumpval*boxzsize
529 c(j,i+nres)=c(j,i+nres)+nojumpval*boxzsize
533 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
534 difference=abs(c(j,i-1)-c(j,i))
535 if (difference.gt.boxzsize/2.0) then
536 if (c(j,i-1).gt.c(j,i)) then
545 c(j,i)=c(j,i)+nojumpval*boxzsize
546 c(j,i+nres)=c(j,i+nres)+nojumpval*boxzsize