3 integer proba, conf, cm1, cm2, accept, nd
4 integer krok, i, n, j, g, ii1, ilosc, ijl
5 integer nnn, seed, proba1, proba2, proba3, proba0x,proba0y,proba0z
6 integer ilosc_atomow1, ilosc_atomow2, korekta1, korekta2
7 integer ile_reszt_mol1, ile_reszt_mol2, ir, peptide,numerr2(90000)
8 integer numera1(90000),numerr1(90000),numera2(90000)
9 integer glys1, glys2, glye1, glye2, ilee
10 real*8 rand, r, boxx, boxy, boxz, dist2acm, dist1acm, b(4), t(3)
11 real*8 minx1, miny1, minz1, maxx1, maxy1, maxz1
12 real*8 minx2, miny2, minz2, maxx2, maxy2, maxz2
13 real*8 distx1, disty1, distz1, distx2, disty2, distz2
14 real*8 xcm1, ycm1, zcm1, xcm2, ycm2, zcm2
15 real*8 dist1cm, dist1cmt, dist2cm, dist2cmt
16 real*8 cm2xr, cm2yr, cm2zr,x2r(90000),y2r(90000),z2r(90000),dist12
17 real*8 angle, c, s, x2new, y2new, z2new
18 character*60 plik1, plik2, plik3, plik4
20 real*8 x1(90000),y1(90000),z1(90000),x2(90000),y2(90000),z2(90000)
21 real*8 dd, wymiar, cmxx(900), cmyy(900), cmzz(900),xt2(90000,3)
24 character*3 r1s, r2s, r1e, r2e
25 character*5 atoma1(90000), atoma2(90000)
26 character*6 nazwaa1(90000), nazwar1(90000)
27 character*6 nazwaa2(90000), nazwar2(90000)
32 c write(*,*)"Sposob uruchamiania:"
33 c write(*,*)"nazwa_programu nazwa_pliku_inp_pdb1
34 c & nazwa_pliku_inp_pdb2 nazwa_pliku_out"
39 write(*,*)"program input_pdb1 input_pdb2
40 & [0-1] 0 for protein, 1 for peptide"
47 open(1,file=plik1,status="old")
48 open(2,file=plik2,status="old")
51 write(*,*) "All files read"
53 read(plik3(1:1),'(i1)') peptide
55 if (peptide.ne.0.and.peptide.ne.1) then
56 write(*,*) "Third parameter must be 0 or 1,
57 & where 0 is for a protein-protein docking,
58 & and 1 is for protein-peptide docking."
62 write(*,*) "Option", peptide, "selected
63 & (0 for protein, 1 for peptide)"
68 read(1,'(a54)',end=22) linia
69 if (linia(1:4).eq.'ATOM'.and.linia(17:17).lt.'B') then
70 write(4,'(a54)') linia
72 if (linia(1:3).eq.'TER') then
73 c write(2,'(a54)') linia
80 write(*,*) "Molecule 1 read"
85 read(2,'(a54)',end=23) linia
86 if (linia(1:4).eq.'ATOM'.and.linia(17:17).lt.'B') then
87 write(5,'(a54)') linia
89 if (linia(1:3).eq.'TER') then
90 c write(2,'(a54)') linia
96 write(*,*) "Molecule 2 read"
129 & atoma1(i),numera1(i),nazwaa1(i),nazwar1(i),chain,numerr1(i),
133 c write(*,300) minx, maxx, miny, maxy, minz, maxz
135 if (x1(i).lt.minx1) minx1=x1(i)
136 if (y1(i).lt.miny1) miny1=y1(i)
137 if (z1(i).lt.minz1) minz1=z1(i)
139 if (x1(i).gt.maxx1) maxx1=x1(i)
140 if (y1(i).gt.maxy1) maxy1=y1(i)
141 if (z1(i).gt.maxz1) maxz1=z1(i)
143 c write(*,300) minx, maxx, miny, maxy, minz, maxz
145 c write(*,*) nazwaa1(i)
146 if (nazwaa1(i).eq.' CA ') then
150 ile_reszt_mol1 = ile_reszt_mol1 +1
153 if (atoma1(i).eq.'TER ') goto 111
154 if (atoma1(i).eq.'END ') goto 111
155 if (i.eq.1) write(3,'(a6)') "REMARK"
156 c write(3,800) atoma1(i),numera1(i),nazwaa1(i),nazwar1(i),
157 c & numerr1(i),x1(i),y1(i),z1(i)
159 c write(*,*) i, x(i),y(i),z(i)
169 xcm1 = xcm1 / (ile_reszt_mol1*1.0)
170 ycm1 = ycm1 / (ile_reszt_mol1*1.0)
171 zcm1 = zcm1 / (ile_reszt_mol1*1.0)
184 if (nazwaa1(i).eq.' CA ') then
190 xcm1 = xcm1 / (ile_reszt_mol1*1.0)
191 ycm1 = ycm1 / (ile_reszt_mol1*1.0)
192 zcm1 = zcm1 / (ile_reszt_mol1*1.0)
197 c write(3,800) atoma1(i),numera1(i),nazwaa1(i),nazwar1(i),
198 c & numerr1(i),x1(i)-xcm1,y1(i)-ycm1,z1(i)-zcm1
200 dist1cmt = dsqrt(((xcm1-x1(i))**2)+
204 c write(*,*) dist1cmt, dist1cm, i, cm1
205 if (dist1cm.gt.dist1cmt) then
214 dist1cmt = dsqrt(((x1(j)-x1(i))**2)+
215 & ((y1(j)-y1(i))**2)+
216 & ((z1(j)-z1(i))**2))
217 if (dist1acm.lt.dist1cmt) then
225 c write(3,304) "ENDMDL"
227 write(*,*) "Molecule 1 calculated"
238 & atoma2(i),numera2(i),nazwaa2(i),nazwar2(i),chain,numerr2(i),
241 c write(*,300) minx, maxx, miny, maxy, minz, maxz
243 if (x2(i).lt.minx2) minx2=x2(i)
244 if (y2(i).lt.miny2) miny2=y2(i)
245 if (z2(i).lt.minz2) minz2=z2(i)
247 if (x2(i).gt.maxx2) maxx2=x2(i)
248 if (y2(i).gt.maxy2) maxy2=y2(i)
249 if (z2(i).gt.maxz2) maxz2=z2(i)
251 c write(*,300) minx, maxx, miny, maxy, minz, maxz
253 c write(*,*) nazwaa1(i)
254 if (nazwaa2(i).eq.' CA ') then
258 ile_reszt_mol2 = ile_reszt_mol2 + 1
261 if (atoma2(i).eq.'TER ') goto 111
262 if (atoma2(i).eq.'END ') goto 111
263 c if (i.eq.1) write(3,'(a6)') "REMARK"
264 c write(3,800) atoma2(i),numera2(i),nazwaa2(i),nazwar2(i),
265 c & numerr2(i),x2(i),y2(i),z2(i)
266 c write(*,*) i, x(i),y(i),z(i)
277 xcm2 = xcm2 / (ile_reszt_mol2*1.0)
278 ycm2 = ycm2 / (ile_reszt_mol2*1.0)
279 zcm2 = zcm2 / (ile_reszt_mol2*1.0)
285 c write(*,*) x2(i),y2(i),z2(i)
289 c write(*,*) xt2(i,1), xt2(i,2), xt2(i,3)
296 if (nazwaa2(i).eq.' CA ') then
302 xcm2 = xcm2 / (ile_reszt_mol2*1.0)
303 ycm2 = ycm2 / (ile_reszt_mol2*1.0)
304 zcm2 = zcm2 / (ile_reszt_mol2*1.0)
310 c write(3,800) atoma2(i),numera2(i),nazwaa2(i),nazwar2(i),
311 c & numerr2(i),x2(i)-xcm2,y2(i)-ycm2,z2(i)-zcm2
313 dist2cmt = dsqrt(((xcm2-x2(i))**2)+
317 c write(*,*) dist2cmt, dist2cm, i, cm2
318 if (dist2cm.gt.dist2cmt) then
328 dist2cmt = dsqrt(((x2(j)-x2(i))**2)+
329 & ((y2(j)-y2(i))**2)+
330 & ((z2(j)-z2(i))**2))
331 if (dist2acm.lt.dist2cmt) then
346 r1e=nazwar1(ile_reszt_mol1)
347 r2e=nazwar2(ile_reszt_mol2)
349 if (r1s.eq."GLY") then
351 write(*,*) "Chain 1 is starting from Gly ", r1s, glys1
354 if (r2s.eq."GLY") then
356 write(*,*) "Chain 2 is starting from Gly ", r2s, glys2
359 if (r1e.eq."GLY") then
361 write(*,*) "Chain 1 is ending at Gly ", r1e, glye1
365 if (r2e.eq."GLY") then
367 write(*,*) "Chain 2 is ending from Gly ", r2e, glye2
373 if(glys1.eq.1) ilee=ilee-1
374 if(glys2.eq.1) ilee=ilee-1
375 if(glye1.eq.1) ilee=ilee-1
376 if(glye2.eq.1) ilee=ilee-1
377 write(*,*) "How many dummy atoms:", ilee
381 write(*,*) "Molecule 2 calculated"
382 write(*,*) "Number of atoms:", ilosc_atomow1, ilosc_atomow2
384 write(*,*) "Min and max coordinates in the systems"
385 write(*,300) minx1, maxx1, miny1, maxy1, minz1, maxz1
386 write(*,300) minx2, maxx2, miny2, maxy2, minz2, maxz2
388 write(*,*) "Distances in axes x, y, z"
389 write(*,301) distx1, disty1, distz1
390 write(*,301) distx2, disty2, distz2
392 boxx = (distx1 + distx2)*1.5 + 20.0
393 boxy = (disty1 + disty2)*1.5 + 20.0
394 boxz = (distz1 + distz2)*1.5 + 20.0
396 c write(*,*) "Boxsize [x, y, z]"
397 c write(*,301) boxx, boxy, boxz
399 write(*,*) "Maximum distances:"
400 write(*,*) dist1acm, dist2acm
402 write(*,*) "Boxsize (suggested)"
403 write(*,*) (dist1acm+dist2acm)*1.2+20
404 open(61,file='boxsize.txt')
405 write(61,302) ((dist1acm+dist2acm)*1.2+20)
408 write(*,*) "Center of masses:"
409 write(*,301) xcm1, ycm1, zcm1
410 write(*,301) xcm2, ycm2, zcm2
412 write(*,*) "Center of masses atoms:"
413 write(*,800) atoma1(cm1),numera1(cm1),nazwaa1(cm1),nazwar1(cm1),
414 & " ",numerr1(cm1),x1(cm1),y1(cm1),z1(cm1)
415 write(*,800) atoma2(cm2),numera2(cm2),nazwaa2(cm2),nazwar2(cm2),
416 & " ",numerr2(cm2),x2(cm2),y2(cm2),z2(cm2)
419 write(*,*) "Number of amino-acid residues in two proteins:"
420 write(*,*) ile_reszt_mol1, ile_reszt_mol2
423 c ---------------------------------------------------------------------
425 c ---------------------------------------------------------------------
427 korekta1 = numerr1(1)
428 write(*,*) "Original number of the first residue in
429 & the first protein:"
430 write(*,*) numerr1(1)
432 write(*,*) "Correction of the first residue in the first protein:"
436 c wymiar=(distx1 + distx2)+(disty1 + disty2)+(distz1 + distz2)
440 c write(*,*) "Minimum required distance between centers of mass:"
443 boxx = (7+distx1 + dist2acm)/2.0
444 boxy = (7+disty1 + dist2acm)/2.0
445 boxz = (7+distz1 + dist2acm)/2.0
446 write(*,*) "Rotation space (+/-):", boxx, boxy, boxz
462 write (plik3, "(A6,I1,a4)") "model0", ii1, ".pdb"
464 write (plik3, "(A5,I2,a4)") "model", ii1, ".pdb"
467 write(*,*) "Conformation will be saved to file:", plik3
469 c plik3a = plik3//ilosc
474 write(3,800) atoma1(i),numera1(i),nazwaa1(i),nazwar1(i),"A",
475 & (numerr1(i)-korekta1+1),
479 c write(3,304) "ENDMDL"
481 if (peptide.eq.1) then
482 wymiar=((distx1 + distx2)+(disty1 + disty2)+(distz1 + distz2))/4
485 if (peptide.eq.0) then
486 wymiar=((distx1 + distx2)+(disty1 + disty2)+(distz1 + distz2))/7
490 write(*,*) "Initial minimum distance between centers of mass:",
494 c ROTATIONS OF THE SECOND MOLECULE
499 call ranorND(b,nd,ilosc_atomow2,ii1)
503 call rot_trans(xt2,t,b,xf,ilosc_atomow2)
513 if (conf.gt.1) goto 133
518 c write(*,*)rand(0),rand(0),rand(0)
519 c write(*,*)rand(0),rand(0),rand(0)
521 cm2xr = (rand(0)*2*boxx)-(boxx)
522 cm2yr = (rand(0)*2*boxy)-(boxy)
523 cm2zr = (rand(0)*2*boxz)-(boxz)
524 c write(*,*) cm2xr, cm2yr, cm2zr
525 c write(*,300)rand(0),rand(0),rand(0)
527 c write(*,*) ABS(cm2xr+xcm1), (dist1acm+dist2acm+3)
529 c if (ABS(cm2xr+xcm1).gt.((dist1acm+dist2acm+5)*0.8)) then
534 c if (ABS(cm2yr+ycm1).gt.((dist1acm+dist2acm+5)*0.8)) then
539 c if (ABS(cm2zr+zcm1).gt.((dist1acm+dist2acm+5)*0.8)) then
552 c SPRAWDZANIE CZY NIE JEST ZBYT PODOBNE DO JUZ WYLOSOWANEGO
560 dd=sqrt((cm2xr-cmxx(ir))**2+(cm2yr-cmyy(ir))**2+
561 & (cm2zr-cmzz(ir))**2)
563 c write(*,*) "Center of mass is", dd, "A away from", ir
564 c write(*,*) "Minimum distance required:", wymiar, "A"
566 c write(*,*) ii1, ir, proba3, dd, wymiar
568 if (dd.lt.wymiar) then
570 if (proba3.gt.1.and.peptide.eq.1) wymiar=wymiar*0.99992
571 if (proba3.gt.1.and.peptide.eq.0) wymiar=wymiar*0.99992
572 c write(*,*) proba3, wymiar
582 c SPRAWDZANIE ODLEGLOSCI
585 c write(3,800) atoma2(i),numera2(i),nazwaa2(i),nazwar2(i),
586 c & numerr2(i),x2(i)-xcm2,y2(i)-ycm2,z2(i)-zcm2
589 dist12 = sqrt(((x2r(i)-x1(j))**2)+
590 & ((y2r(i)-y1(j))**2)+
591 & ((z2r(i)-z1(j))**2))
592 c write(*,*) dist12, cm2xr, cm2yr, cm2zr
593 if (dist12.lt.2.5) then
598 if (dist12.le.3.5) accept=1
599 c if (dist12.le.3.5) accept=1
600 c if (dist12.gt.3.5) proba2=proba2+1
604 c write(*,*) "No overlaps", proba
605 if (accept.eq.0) goto 200
606 c write(*,*) "No overlaps, contact", conf, proba
607 c write(3,305) "MODEL", conf
612 write(*,*) "Conformation", ii1, "Is accepted after",
613 & proba0x+proba0y+proba0z,
614 & proba1, proba2, proba3, proba, "attempts. ",
615 & "Dist between CoM of previous=", wymiar
618 write(*,*)"Extr",ABS(cm2xr+xcm1), ABS(cm2yr+ycm1), ABS(cm2zr+zcm1)
628 korekta2 = numerr2(1)-1
629 c write(*,*) "Original number of the first residue in
630 c & the second protein:"
631 c write(*,*) numerr2(1)
633 c write(*,*)"Correction of the first residue in the second protein:"
634 c write(*,*) korekta2
636 write(3,800) atoma2(i),numera2(i),nazwaa2(i),nazwar2(i),"B",
637 & (numerr2(i)+ile_reszt_mol1-korekta2),
638 & x2r(i),y2r(i),z2r(i)
641 c write(3,304) "ENDMDL"
642 c write(3,305) "MODEL", conf
656 write (plik4, "(A9,I1,a4)") "template0", ii1, ".sco"
658 write (plik4, "(A8,I2,a4)") "template", ii1, ".sco"
664 if (peptide.eq.1) then
665 do ijl=1,(ile_reszt_mol1+ile_reszt_mol2+ilee)
667 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "0"
668 if (ijl.le.ile_reszt_mol1+1.and.ijl.gt.1)
669 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
670 if (ijl.ge.(ile_reszt_mol1+2))
671 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
675 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "1"
676 if (ijl.le.ile_reszt_mol1.and.ijl.gt.1)
677 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
678 if (ijl.ge.(ile_reszt_mol1+1))
679 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
685 if (peptide.eq.0) then
686 do ijl=1,(ile_reszt_mol1+ile_reszt_mol2+ilee)
689 if (glys1.eq.0.and.glye1.eq.0.and.glys2.eq.0) then
690 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "0"
691 if (ijl.le.ile_reszt_mol1+1.and.ijl.gt.1)
692 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
693 if (ijl.ge.(ile_reszt_mol1+2).and.ijl.le.(ile_reszt_mol1+3))
694 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
695 if (ijl.gt.(ile_reszt_mol1+3).and.
696 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1+3))
697 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
698 if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+4))
699 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
704 if (glys1.eq.1.and.glye1.eq.0.and.glys2.eq.0) then
705 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "1"
706 if (ijl.le.ile_reszt_mol1.and.ijl.gt.1)
707 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
708 if (ijl.ge.(ile_reszt_mol1+1).and.ijl.le.(ile_reszt_mol1+2))
709 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
710 if (ijl.gt.(ile_reszt_mol1+2).and.
711 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1+2))
712 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
713 if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+3))
714 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
718 if (glys1.eq.0.and.glye1.eq.1.and.glys2.eq.0) then
719 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "0"
720 if (ijl.le.ile_reszt_mol1+1.and.ijl.gt.1)
721 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
722 if (ijl.ge.(ile_reszt_mol1+2).and.ijl.le.(ile_reszt_mol1+2))
723 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
724 if (ijl.gt.(ile_reszt_mol1+2).and.
725 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1+2))
726 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
727 if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+3))
728 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
731 c chain 1 first Gly and chain 1 last Gly
732 if (glys1.eq.1.and.glye1.eq.1.and.glys2.eq.0) then
733 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "1"
734 if (ijl.le.ile_reszt_mol1.and.ijl.gt.1)
735 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
736 if (ijl.ge.(ile_reszt_mol1+1).and.ijl.le.(ile_reszt_mol1+1))
737 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
738 if (ijl.gt.(ile_reszt_mol1+1).and.
739 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1+1))
740 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
741 if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+2))
742 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
746 if (glys1.eq.0.and.glye1.eq.0.and.glys2.eq.1) then
747 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "0"
748 if (ijl.le.ile_reszt_mol1+1.and.ijl.gt.1)
749 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
750 if (ijl.ge.(ile_reszt_mol1+2).and.ijl.le.(ile_reszt_mol1+2))
751 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
752 if (ijl.gt.(ile_reszt_mol1+2).and.
753 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1+2))
754 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
755 if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+3))
756 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
759 c chain 1 first Gly chain 2 first Gly
760 if (glys1.eq.1.and.glye1.eq.0.and.glys2.eq.1) then
761 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "1"
762 if (ijl.le.ile_reszt_mol1.and.ijl.gt.1)
763 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
764 if (ijl.ge.(ile_reszt_mol1+1).and.ijl.le.(ile_reszt_mol1+1))
765 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
766 if (ijl.gt.(ile_reszt_mol1+1).and.
767 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1+1))
768 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
769 if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+2))
770 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
773 c chain 1 last Gly chain 2 first Gly
774 if (glys1.eq.0.and.glye1.eq.1.and.glys2.eq.1) then
775 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "0"
776 if (ijl.le.ile_reszt_mol1+1.and.ijl.gt.1)
777 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
778 c if (ijl.ge.(ile_reszt_mol1+2).and.ijl.le.(ile_reszt_mol1+3))
779 c & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
780 if (ijl.gt.(ile_reszt_mol1+1).and.
781 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1+1))
782 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
783 if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+2))
784 & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
788 if (glys1.eq.1.and.glye1.eq.1.and.glys2.eq.1) then
789 if (ijl.eq.1) write(7,*) ijl, "1.0 1.0 1.0 ", "1"
790 if (ijl.le.ile_reszt_mol1.and.ijl.gt.1)
791 & write(7,*) ijl, "1.0 1.0 1.0 ", "1"
792 c if (ijl.ge.(ile_reszt_mol1+2).and.ijl.le.(ile_reszt_mol1+3))
793 c & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
794 if (ijl.gt.(ile_reszt_mol1).and.
795 & ijl.le.(ile_reszt_mol2+ile_reszt_mol1))
796 & write(7,*) ijl, "1.0 1.0 1.0 ", "2"
797 c if (ijl.ge.(ile_reszt_mol2+ile_reszt_mol1+1))
798 c & write(7,*) ijl, "1.0 1.0 1.0 ", "0"
809 c koniec petli po ilosci struktur
813 c write(*,*) i, cmxx(i), cmyy(i), cmzz(i)
814 c dd=(cm2xr-cmxx(ir))**2+(cm2yr-cmyy(ir))**2+(cm2zr-cmyy(ir))**2
819 c dd=sqrt((cmxx(i)-cmxx(j))**2+(cmyy(i)-cmyy(j))**2+
820 c & (cmzz(i)-cmzz(j))**2)
829 800 format(a4,2X,i5,1X,a4,1X,a3,1X,a1,i4,4X,3f8.3)
838 SUBROUTINE SRAND(ISEED)
840 C This subroutine sets the integer seed to be used with the
841 C companion RAND function to the value of ISEED. A flag is
842 C set to indicate that the sequence of pseudo-random numbers
843 C for the specified seed should start from the beginning.
845 COMMON /SEED/JSEED,IFRST
854 C This function returns a pseudo-random number for each invocation.
855 C It is a FORTRAN 77 adaptation of the "Integer Version 2" minimal
856 C standard number generator whose Pascal code appears in the article:
858 C Park, Steven K. and Miller, Keith W., "Random Number Generators:
859 C Good Ones are Hard to Find", Communications of the ACM,
862 PARAMETER (MPLIER=16807,MODLUS=2147483647,MOBYMP=127773,
865 COMMON /SEED/JSEED,IFRST
866 INTEGER HVLUE, LVLUE, TESTV, NEXTN
869 IF (IFRST .EQ. 0) THEN
874 HVLUE = NEXTN / MOBYMP
875 LVLUE = MOD(NEXTN, MOBYMP)
876 TESTV = MPLIER*LVLUE - MOMDMP*HVLUE
877 IF (TESTV .GT. 0) THEN
880 NEXTN = TESTV + MODLUS
882 RAND = REAL(NEXTN)/REAL(MODLUS)
887 COMMON /SEED/JSEED,IFRST
889 DATA JSEED,IFRST/123456789,0/
893 Subroutine ranorND(b,nd,ilosc_atomow2,ii1)
895 C generates a random vector on a unit sphere onC an ND-dimensional space.
896 C algorithm 40 page 410.
897 C the algorithm assumes that the formula for bz is valid, i.e
898 C bz=(1.0-2.0*ransq),
899 C and also that, ransq can be computed as as the sum of the independent random
900 C numbers to the second power (expression 3).
901 dimension ran(nd-1), b(nd)
903 c write(*,*) "In Subroutine ranorND(b,nd), nd=", nd
904 c write(*,*) "ilosc_atomow2=", ilosc_atomow2
905 c do j=1,ilosc_atomow2
909 do while (ransq.ge.1)
913 ran(i)=1.0-2.0*rand(0)
914 c write(*,*) i, ran(i)
915 rsq=ran(i)*ran(i)+rsq ! (3)
919 c write(*,*) j, ransq
921 ranh=2.0*sqrt(1.0-ransq)
922 c write(*,*) j, ranh, ransq
925 c write(*,*) ran(i), ranh
927 b(nd)=(1.0-2.0*ransq)
928 c write(*,*) b(1,j), b(2,j), b(3,j), b(4,j)
933 subroutine rot_trans(xt2,t,q,xf,ilosc_atomow2)
934 C x coordinates, t translation vector, q quaternion
935 double precision xt2(90000,3),xf(90000,3)
936 double precision t(3),q(4)
938 write(*,*) "Rotation vector:", q(1), q(2), q(3), q(4)
939 r11= q(1)*q(1)+q(2)*q(2)-q(3)*q(3)-q(4)*q(4)
940 r22= q(1)*q(1)-q(2)*q(2)+q(3)*q(3)-q(4)*q(4)
941 r33= q(1)*q(1)-q(2)*q(2)-q(3)*q(3)+q(4)*q(4)
942 r12= 2*(q(2)*q(3)-q(1)*q(4))
943 r21= 2*(q(2)*q(3)+q(1)*q(4))
944 r13= 2*(q(2)*q(4)+q(1)*q(3))
945 r31= 2*(q(2)*q(4)-q(1)*q(3))
946 r23= 2*(q(3)*q(4)-q(1)*q(2))
947 r32= 2*(q(3)*q(4)+q(1)*q(2))
949 c write(*,*) r11, r22, r33, r12, r21, r13, r31, r23, r32
952 xf(i,1)= r11*xt2(i,1)+r12*xt2(i,2)+r13*xt2(i,3) + t(1)
953 xf(i,2)= r21*xt2(i,1)+r22*xt2(i,2)+r23*xt2(i,3) + t(2)
954 xf(i,3)= r31*xt2(i,1)+r32*xt2(i,2)+r33*xt2(i,3) + t(3)
955 c write(*,*) i, xt2(i,1), xt2(i,2), xt2(i,3)
956 c write(*,*) i, xf(i,1), xf(i,2), xf(i,3)