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 CA's 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
47 * Build the alpha-carbon chain.
50 call locate_next_res(i)
53 C First and last SC must coincide with the corresponding CA.
57 dc_norm(j,nres+1)=0.0D0
59 dc_norm(j,nres+nres)=0.0D0
61 c(j,nres+nres)=c(j,nres)
69 write (iout,'(/a)') 'Recalculated internal coordinates'
72 c(j,maxres2)=0.5D0*(c(j,i-1)+c(j,i+1))
75 if (i.gt.3) be=rad2deg*beta(i-3,i-2,i-1,i)
76 be1=rad2deg*beta(nres+i,i,maxres2,i+1)
78 if (i.gt.2) alfai=rad2deg*alpha(i-2,i-1,i)
79 write (iout,1212) restyp(itype(i)),i,dist(i-1,i),
80 & alfai,be,dist(nres+i,i),rad2deg*alpha(nres+i,i,maxres2),be1
82 1212 format (a3,'(',i3,')',2(f10.5,2f10.2))
89 c-------------------------------------------------------------------------
92 C Define the origin and orientation of the coordinate system and locate
93 C the first three atoms.
95 implicit real*8 (a-h,o-z)
97 include 'COMMON.CHAIN'
98 include 'COMMON.LOCAL'
152 dc_norm(j,2)=prod(j,1,2)
153 dc(j,2)=vbld(3)*prod(j,1,2)
154 c(j,3)=c(j,2)+dc(j,2)
156 call locate_side_chain(2)
159 c-----------------------------------------------------------------------------
160 subroutine locate_next_res(i)
162 C Locate CA(i) and SC(i-1)
164 implicit real*8 (a-h,o-z)
166 include 'COMMON.CHAIN'
167 include 'COMMON.LOCAL'
170 include 'COMMON.IOUNITS'
171 include 'COMMON.NAMES'
172 include 'COMMON.INTERACT'
174 C Define the rotation matrices corresponding to CA(i)
178 if (theti.ne.theti) theti=100.0
180 if (phii.ne.phii) phii=180.0
189 * Define the matrices of the rotation about the virtual-bond valence angles
190 * theta, T(i,j,k), virtual-bond dihedral angles gamma (miscalled PHI in this
191 * program), R(i,j,k), and, the cumulative matrices of rotation RT
213 rt(2,1,i-2)=sint*cosphi
214 rt(2,2,i-2)=-cost*cosphi
216 rt(3,1,i-2)=-sint*sinphi
217 rt(3,2,i-2)=cost*sinphi
219 call matmult(prod(1,1,i-2),rt(1,1,i-2),prod(1,1,i-1))
221 dc_norm(j,i-1)=prod(j,1,i-1)
222 dc(j,i-1)=vbld(i)*prod(j,1,i-1)
223 c(j,i)=c(j,i-1)+dc(j,i-1)
225 cd print '(2i3,2(3f10.5,5x))', i-1,i,(dc(j,i-1),j=1,3),(c(j,i),j=1,3)
227 C Now calculate the coordinates of SC(i-1)
229 call locate_side_chain(i-1)
232 c-----------------------------------------------------------------------------
233 subroutine locate_side_chain(i)
235 C Locate the side-chain centroid i, 1 < i < NRES. Put in C(*,NRES+i).
237 implicit real*8 (a-h,o-z)
239 include 'COMMON.CHAIN'
240 include 'COMMON.LOCAL'
243 include 'COMMON.IOUNITS'
244 include 'COMMON.NAMES'
245 include 'COMMON.INTERACT'
249 c dsci_inv=dsc_inv(itype(i))
251 dsci_inv=vbld_inv(i+nres)
255 if (alphi.ne.alphi) alphi=100.0
256 if (omegi.ne.omegi) omegi=-100.0
266 yp= dsci*sinalphi*cosomegi
267 zp=-dsci*sinalphi*sinomegi
268 * Now we have to rotate the coordinate system by 180-theta(i)/2 so as to get its
269 * X-axis aligned with the vector DC(*,i)
270 theta2=pi-0.5D0*theta(i+1)
273 xx(1)= xp*cost2+yp*sint2
274 xx(2)=-xp*sint2+yp*cost2
276 cd print '(a3,i3,3f10.5,5x,3f10.5)',restyp(itype(i)),i,
277 cd & xp,yp,zp,(xx(k),k=1,3)
281 * Bring the SC vectors to the common coordinate system.
283 xx(2)=xloc(2,i)*r(2,2,i-1)+xloc(3,i)*r(2,3,i-1)
284 xx(3)=xloc(2,i)*r(3,2,i-1)+xloc(3,i)*r(3,3,i-1)
291 rj=rj+prod(j,k,i-1)*xx(k)
294 dc_norm(j,nres+i)=rj*dsci_inv
295 c(j,nres+i)=c(j,i)+rj
299 c------------------------------------------
305 include 'COMMON.CONTROL'
309 include 'COMMON.LANGEVIN'
311 include 'COMMON.LANGEVIN.lang0'
313 include 'COMMON.CHAIN'
314 include 'COMMON.DERIV'
316 include 'COMMON.LOCAL'
317 include 'COMMON.INTERACT'
318 include 'COMMON.IOUNITS'
319 include 'COMMON.NAMES'
320 include 'COMMON.TIME1'
321 include 'COMMON.REMD'
322 include 'COMMON.SETUP'
323 include 'COMMON.MUCA'
324 include 'COMMON.HAIRPIN'
325 C change suggested by Ana - begin
327 C change suggested by Ana - end
331 C write(*,*) 'initial', i,j,c(j,i)
333 C change suggested by Ana - begin
335 C change suggested by Ana -end
337 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
339 if (allareout.eq.1) then
340 ireturnval=int(c(j,i)/boxxsize)
341 if (c(j,i).le.0) ireturnval=ireturnval-1
342 do k=chain_beg,chain_end
343 c(j,k)=c(j,k)-ireturnval*boxxsize
344 c(j,k+nres)=c(j,k+nres)-ireturnval*boxxsize
348 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
349 C Suggested by Ana -end
354 if (int(c(j,i)/boxxsize).eq.0) allareout=0
357 if (allareout.eq.1) then
358 ireturnval=int(c(j,i)/boxxsize)
359 if (c(j,i).le.0) ireturnval=ireturnval-1
361 c(j,k)=c(j,k)-ireturnval*boxxsize
362 c(j,k+nres)=c(j,k+nres)-ireturnval*boxxsize
367 C write(*,*) 'befor no jump', i,j,c(j,i)
371 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
372 difference=abs(c(j,i-1)-c(j,i))
373 C print *,'diff', difference
374 if (difference.gt.boxxsize/2.0) then
375 if (c(j,i-1).gt.c(j,i)) then
384 c(j,i)=c(j,i)+nojumpval*boxxsize
385 c(j,i+nres)=c(j,i+nres)+nojumpval*boxxsize
389 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
390 difference=abs(c(j,i-1)-c(j,i))
391 if (difference.gt.boxxsize/2.0) then
392 if (c(j,i-1).gt.c(j,i)) then
401 c(j,i)=c(j,i)+nojumpval*boxxsize
402 c(j,i+nres)=c(j,i+nres)+nojumpval*boxxsize
406 C write(*,*) 'after no jump', i,j,c(j,i)
410 C suggesed by Ana begins
412 C suggested by Ana ends
416 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
418 if (allareout.eq.1) then
419 ireturnval=int(c(j,i)/boxysize)
420 if (c(j,i).le.0) ireturnval=ireturnval-1
421 do k=chain_beg,chain_end
422 c(j,k)=c(j,k)-ireturnval*boxysize
423 c(j,k+nres)=c(j,k+nres)-ireturnval*boxysize
427 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
428 C Suggested by Ana -end
433 if (int(c(j,i)/boxysize).eq.0) allareout=0
436 if (allareout.eq.1) then
437 ireturnval=int(c(j,i)/boxysize)
438 if (c(j,i).le.0) ireturnval=ireturnval-1
440 c(j,k)=c(j,k)-ireturnval*boxysize
441 c(j,k+nres)=c(j,k+nres)-ireturnval*boxysize
446 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
447 difference=abs(c(j,i-1)-c(j,i))
448 if (difference.gt.boxysize/2.0) then
449 if (c(j,i-1).gt.c(j,i)) then
458 c(j,i)=c(j,i)+nojumpval*boxysize
459 c(j,i+nres)=c(j,i+nres)+nojumpval*boxysize
463 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
464 difference=abs(c(j,i-1)-c(j,i))
465 if (difference.gt.boxysize/2.0) then
466 if (c(j,i-1).gt.c(j,i)) then
475 c(j,i)=c(j,i)+nojumpval*boxysize
476 c(j,i+nres)=c(j,i+nres)+nojumpval*boxysize
479 C Suggested by Ana -begins
481 C Suggested by Ana -ends
485 if ((itype(i).eq.ntyp1).and.(itype(i+1).eq.ntyp1)) then
487 if (allareout.eq.1) then
488 ireturnval=int(c(j,i)/boxysize)
489 if (c(j,i).le.0) ireturnval=ireturnval-1
490 do k=chain_beg,chain_end
491 c(j,k)=c(j,k)-ireturnval*boxzsize
492 c(j,k+nres)=c(j,k+nres)-ireturnval*boxzsize
496 & dc_old(1,0)=dc_old(1,0)-ireturnval*boxxsize
497 C Suggested by Ana -end
502 if (int(c(j,i)/boxzsize).eq.0) allareout=0
505 if (allareout.eq.1) then
506 ireturnval=int(c(j,i)/boxzsize)
507 if (c(j,i).le.0) ireturnval=ireturnval-1
509 c(j,k)=c(j,k)-ireturnval*boxzsize
510 c(j,k+nres)=c(j,k+nres)-ireturnval*boxzsize
515 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
516 difference=abs(c(j,i-1)-c(j,i))
517 if (difference.gt.(boxzsize/2.0)) then
518 if (c(j,i-1).gt.c(j,i)) then
527 c(j,i)=c(j,i)+nojumpval*boxzsize
528 c(j,i+nres)=c(j,i+nres)+nojumpval*boxzsize
532 if (itype(i).eq.ntyp1 .and. itype(i-1).eq.ntyp1) then
533 difference=abs(c(j,i-1)-c(j,i))
534 if (difference.gt.boxzsize/2.0) then
535 if (c(j,i-1).gt.c(j,i)) then
544 c(j,i)=c(j,i)+nojumpval*boxzsize
545 c(j,i+nres)=c(j,i+nres)+nojumpval*boxzsize