2 C Read the PDB file and convert the peptide geometry into virtual-chain
6 include 'COMMON.CONTROL'
10 include 'COMMON.INTERACT'
11 include 'COMMON.IOUNITS'
13 include 'COMMON.NAMES'
14 include 'COMMON.SBRIDGE'
16 character*3 seq,atom,res
18 double precision e1(3),e2(3),e3(3)
19 double precision sccor(3,50)
20 integer i,j,iii,ibeg,ishift,ishift1,ity,ires,ires_old
22 integer rescode,kkk,lll,icha,cou,kupa,iprzes
23 logical lsecondary,sccalc,fail,zero
24 integer iterter(maxres)
25 double precision efree_temp
42 read (ipdbin,'(a80)',end=10) card
43 c write (iout,'(a)') card
45 if (card(:5).eq.'HELIX') then
48 read(card(22:25),*) hfrag(1,nhfrag)
49 read(card(34:37),*) hfrag(2,nhfrag)
51 if (card(:5).eq.'SHEET') then
54 read(card(24:26),*) bfrag(1,nbfrag)
55 read(card(35:37),*) bfrag(2,nbfrag)
56 !rc----------------------------------------
57 !rc to be corrected !!!
58 bfrag(3,nbfrag)=bfrag(1,nbfrag)
59 bfrag(4,nbfrag)=bfrag(2,nbfrag)
60 !rc----------------------------------------
62 if (card(:3).eq.'END') then
64 else if (card(:3).eq.'TER') then
67 itype(ires_old-1)=ntyp1
73 write (iout,*) "Chain ended",ires,ishift,ires_old,ibeg
76 dc(j,ires)=sccor(j,iii)
79 call sccenter(ires,iii,sccor)
85 c if (index(card,"FREE ENERGY").gt.0) then
86 c ifree=index(card,"FREE ENERGY")+12
87 c read(card(ifree:),*,err=1115,end=1115) efree_temp
90 ! Fish out the ATOM cards.
91 if (index(card(1:4),'ATOM').gt.0) then
93 read (card(12:16),*) atom
94 c write (2,'(a)') card
95 c write (iout,*) "ibeg",ibeg
96 c write (iout,*) "! ",atom," !",ires
97 ! if (atom.eq.'CA' .or. atom.eq.'CH3') then
98 read (card(23:26),*) ires
99 read (card(18:20),'(a3)') res
100 c write (iout,*) "ires",ires,ires-ishift+ishift1,
101 c & " ires_old",ires_old
102 c write (iout,*) "ishift",ishift," ishift1",ishift1
103 c write (iout,*) "IRES",ires-ishift+ishift1,ires_old
104 if (ires-ishift+ishift1.ne.ires_old) then
105 ! Calculate the CM of the preceding residue.
106 ! if (ibeg.eq.0) call sccenter(ires,iii,sccor)
108 c write (iout,*) "Calculating sidechain center iii",iii
109 c write (iout,*) "ires",ires
111 c write (iout,'(i5,3f10.5)') ires,(sccor(j,iii),j=1,3)
113 dc(j,ires_old)=sccor(j,iii)
116 call sccenter(ires_old,iii,sccor)
122 c write (iout,*) "ibeg",ibeg
123 if (res.eq.'Cl-' .or. res.eq.'Na+') then
126 else if (ibeg.eq.1) then
127 c write (iout,*) "BEG ires",ires
129 if (res.ne.'GLY' .and. res.ne. 'ACE') then
133 ires=ires-ishift+ishift1
135 ! write (iout,*) "ishift",ishift," ires",ires,&
136 ! " ires_old",ires_old
138 else if (ibeg.eq.2) then
140 ishift=-ires_old+ires-1 !!!!!
141 c ishift1=ishift1-1 !!!!!
142 c write (iout,*) "New chain started",ires,ires_old,ishift,
144 ires=ires-ishift+ishift1
145 write (iout,*) "New chain started ires",ires
150 ishift=ishift-(ires-ishift+ishift1-ires_old-1)
151 ires=ires-ishift+ishift1
154 if (res.eq.'ACE' .or. res.eq.'NHE') then
157 itype(ires)=rescode(ires,res,0)
160 ires=ires-ishift+ishift1
162 c write (iout,*) "ires_old",ires_old," ires",ires
163 if (card(27:27).eq."A" .or. card(27:27).eq."B") then
166 c write (2,*) "ires",ires," res ",res!," ity"!,ity
167 if (atom.eq.'CA' .or. atom.eq.'CH3' .or.
168 & res.eq.'NHE'.and.atom(:2).eq.'HN') then
169 read(card(31:54),'(3f8.3)') (c(j,ires),j=1,3)
170 c write (iout,*) "backbone ",atom
171 c write (iout,*) ires,res,(c(j,ires),j=1,3)
173 write (iout,'(i6,i3,2x,a,3f8.3)')
174 & ires,itype(ires),res,(c(j,ires),j=1,3)
178 sccor(j,iii)=c(j,ires)
180 c write (2,*) card(23:27),ires,itype(ires),iii
181 else if (atom.ne.'O'.and.atom(1:1).ne.'H' .and.
182 & atom.ne.'N' .and. atom.ne.'C' .and.
183 & atom(:2).ne.'1H' .and. atom(:2).ne.'2H' .and.
184 & atom.ne.'OXT' .and. atom(:2).ne.'3H') then
185 ! write (iout,*) "sidechain ",atom
187 read(card(31:54),'(3f8.3)') (sccor(j,iii),j=1,3)
188 c write (2,*) "iii",iii
192 10 write (iout,'(a,i5)') ' Nres: ',ires
193 c write (iout,*) "iii",iii
194 C Calculate dummy residue coordinates inside the "chain" of a multichain
197 c write (iout,*) "dc"
199 c write (iout,'(i5,3f10.5)') i,(dc(j,i),j=1,3)
202 c write (iout,*) i,itype(i),itype(i+1),ntyp1,iterter(i)
203 if (itype(i).eq.ntyp1.and.iterter(i).eq.1) then
204 if (itype(i+1).eq.ntyp1.and.iterter(i+1).eq.1 ) then
205 C 16/01/2014 by Adasko: Adding to dummy atoms in the chain
206 C first is connected prevous chain (itype(i+1).eq.ntyp1)=true
207 C second dummy atom is conected to next chain itype(i+1).eq.ntyp1=false
209 C 2/15/2013 by Adam: corrected insertion of the last dummy residue
210 c print *,i,'tu dochodze'
211 call refsys(i-3,i-2,i-1,e1,e2,e3,fail)
219 c(j,i)=c(j,i-1)+1.9d0*(-e1(j)+e2(j))/sqrt(2.0d0)
223 dcj=(c(j,i-2)-c(j,i-3))/2.0
224 if (dcj.eq.0) dcj=1.23591524223
230 else !itype(i+1).eq.ntyp1
232 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
233 call refsys(i+1,i+2,i+3,e1,e2,e3,fail)
240 c(j,i)=c(j,i+1)+1.9d0*(-e1(j)+e2(j))/sqrt(2.0d0)
244 dcj=(c(j,i+3)-c(j,i+2))/2.0
245 if (dcj.eq.0) dcj=1.23591524223
251 endif !itype(i+1).eq.ntyp1
252 endif !itype.eq.ntyp1
254 write (iout,*) "After loop in readpbd"
255 C Calculate the CM of the last side chain.
256 if (.not. sccalc) then
259 dc(j,ires)=sccor(j,iii)
262 c write (iout,*) "Calling sccenter iii",iii
263 call sccenter(ires,iii,sccor)
268 if (itype(nres).ne.10) then
272 C 2/15/2013 by Adam: corrected insertion of the last dummy residue
273 call refsys(nres-3,nres-2,nres-1,e1,e2,e3,fail)
280 c(j,nres)=c(j,nres-1)+1.9d0*(-e1(j)+e2(j))/sqrt(2.0d0)
284 dcj=(c(j,nres-2)-c(j,nres-3))/2.0
285 if (dcj.eq.0) dcj=1.23591524223
286 c(j,nres)=c(j,nres-1)+dcj
287 c(j,2*nres)=c(j,nres)
298 c(j,2*nres)=c(j,nres)
300 if (itype(1).eq.ntyp1) then
304 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
305 call refsys(2,3,4,e1,e2,e3,fail)
312 c(j,1)=c(j,2)+1.9d0*(e1(j)-e2(j))/dsqrt(2.0d0)
316 dcj=(c(j,4)-c(j,3))/2.0
322 C Calculate internal coordinates.
324 & "Cartesian coordinates of the reference structure"
325 write (iout,'(a,3(3x,a5),5x,3(3x,a5))')
326 & "Residue ","X(CA)","Y(CA)","Z(CA)","X(SC)","Y(SC)","Z(SC)"
328 write (iout,'(a3,1x,i4,3f8.3,5x,3f8.3)')
329 & restyp(itype(ires)),ires,(c(j,ires),j=1,3),
330 & (c(j,ires+nres),j=1,3)
334 zero=zero.or.itype(ires).eq.0
337 write (iout,'(2a)') "Gaps in PDB coordinates detected;",
338 & " look for ZERO in the control output above."
339 write (iout,'(2a)') "Repair the PDB file using MODELLER",
340 & " or other softwared and resubmit."
344 c write(iout,*)"before int_from_cart nres",nres
345 call int_from_cart(.true.,.false.)
353 dc(j,i)=c(j,i+1)-c(j,i)
354 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
356 c write (iout,*) i,(dc(j,i),j=1,3),(dc_norm(j,i),j=1,3),
361 dc(j,i+nres)=c(j,i+nres)-c(j,i)
362 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
364 c write (iout,*) i,(dc(j,i+nres),j=1,3),(dc_norm(j,i+nres),j=1,3),
367 call sc_loc_geom(.false.)
368 call int_from_cart1(.false.)
370 C Copy the coordinates to reference coordinates
374 cref(j,i+nres)=c(j,i+nres)
377 100 format (//' alpha-carbon coordinates ',
378 & ' centroid coordinates'/
379 1 ' ', 7X,'X',11X,'Y',11X,'Z',
380 & 10X,'X',11X,'Y',11X,'Z')
381 110 format (a,'(',i4,')',6f12.5)
385 bfrag(i,j)=bfrag(i,j)-ishift
391 hfrag(i,j)=hfrag(i,j)-ishift
396 c---------------------------------------------------------------------------
397 subroutine readpdb_template(k)
398 C Read the PDB file for read_constr_homology with read2sigma
399 C and convert the peptide geometry into virtual-chain geometry.
400 implicit real*8 (a-h,o-z)
402 include 'COMMON.LOCAL'
404 include 'COMMON.CHAIN'
405 include 'COMMON.INTERACT'
406 include 'COMMON.IOUNITS'
408 include 'COMMON.NAMES'
409 include 'COMMON.CONTROL'
410 include 'COMMON.SETUP'
411 integer i,j,ibeg,ishift1,ires,iii,ires_old,ishift,ity
412 logical lprn /.false./,fail
413 double precision e1(3),e2(3),e3(3)
414 double precision dcj,efree_temp
418 double precision sccor(3,20)
419 integer rescode,iterter(maxres)
427 c write (2,*) "UNRES_PDB",unres_pdb
435 read (ipdbin,'(a80)',end=10) card
436 if (card(:3).eq.'END') then
438 else if (card(:3).eq.'TER') then
441 itype(ires_old-1)=ntyp1
442 iterter(ires_old-1)=1
443 itype(ires_old)=ntyp1
446 c write (iout,*) "Chain ended",ires,ishift,ires_old
449 dc(j,ires)=sccor(j,iii)
452 call sccenter(ires,iii,sccor)
455 C Fish out the ATOM cards.
456 if (index(card(1:4),'ATOM').gt.0) then
457 read (card(12:16),*) atom
458 c write (iout,*) "! ",atom," !",ires
459 c if (atom.eq.'CA' .or. atom.eq.'CH3') then
460 read (card(23:26),*) ires
461 read (card(18:20),'(a3)') res
462 c write (iout,*) "ires",ires,ires-ishift+ishift1,
463 c & " ires_old",ires_old
464 c write (iout,*) "ishift",ishift," ishift1",ishift1
465 c write (iout,*) "IRES",ires-ishift+ishift1,ires_old
466 if (ires-ishift+ishift1.ne.ires_old) then
467 C Calculate the CM of the preceding residue.
471 dc(j,ires_old)=sccor(j,iii)
474 call sccenter(ires_old,iii,sccor)
479 if (res.eq.'Cl-' .or. res.eq.'Na+') then
482 else if (ibeg.eq.1) then
483 c write (iout,*) "BEG ires",ires
485 if (res.ne.'GLY' .and. res.ne. 'ACE') then
489 ires=ires-ishift+ishift1
491 c write (iout,*) "ishift",ishift," ires",ires,
492 c & " ires_old",ires_old
493 c write (iout,*) "ires",ires," ibeg",ibeg," ishift",ishift
495 else if (ibeg.eq.2) then
497 ishift=-ires_old+ires-1
499 c write (iout,*) "New chain started",ires,ishift
502 ishift=ishift-(ires-ishift+ishift1-ires_old-1)
503 ires=ires-ishift+ishift1
506 if (res.eq.'ACE' .or. res.eq.'NHE') then
509 itype(ires)=rescode(ires,res,0)
512 ires=ires-ishift+ishift1
514 c write (iout,*) "ires_old",ires_old," ires",ires
515 c if (card(27:27).eq."A" .or. card(27:27).eq."B") then
518 c write (2,*) "ires",ires," res ",res," ity",ity
519 if (atom.eq.'CA' .or. atom.eq.'CH3' .or.
520 & res.eq.'NHE'.and.atom(:2).eq.'HN') then
521 read(card(31:54),'(3f8.3)') (c(j,ires),j=1,3)
522 c write (iout,*) "backbone ",atom ,ires,res, (c(j,ires),j=1,3)
524 write (iout,'(2i3,2x,a,3f8.3)')
525 & ires,itype(ires),res,(c(j,ires),j=1,3)
529 sccor(j,iii)=c(j,ires)
531 if (ishift.ne.0) then
532 ires_ca=ires+ishift-ishift1
536 c write (*,*) card(23:27),ires,itype(ires)
537 else if (atom.ne.'O'.and.atom(1:1).ne.'H' .and.
538 & atom.ne.'N' .and. atom.ne.'C' .and.
539 & atom(:2).ne.'1H' .and. atom(:2).ne.'2H' .and.
540 & atom.ne.'OXT' .and. atom(:2).ne.'3H') then
541 c write (iout,*) "sidechain ",atom
543 read(card(31:54),'(3f8.3)') (sccor(j,iii),j=1,3)
547 10 write (iout,'(a,i5)') ' Nres: ',ires
548 C Calculate dummy residue coordinates inside the "chain" of a multichain
552 c write (iout,*) i,itype(i),itype(i+1)
553 if (itype(i).eq.ntyp1.and.iterter(i).eq.1) then
554 if (itype(i+1).eq.ntyp1.and.iterter(i+1).eq.1 ) then
555 C 16/01/2014 by Adasko: Adding to dummy atoms in the chain
556 C first is connected prevous chain (itype(i+1).eq.ntyp1)=true
557 C second dummy atom is conected to next chain itype(i+1).eq.ntyp1=false
559 C 2/15/2013 by Adam: corrected insertion of the last dummy residue
560 call refsys(i-3,i-2,i-1,e1,e2,e3,fail)
567 c(j,i)=c(j,i-1)-1.9d0*e2(j)
571 dcj=(c(j,i-2)-c(j,i-3))/2.0
572 if (dcj.eq.0) dcj=1.23591524223
577 else !itype(i+1).eq.ntyp1
579 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
580 call refsys(i+1,i+2,i+3,e1,e2,e3,fail)
587 c(j,i)=c(j,i+1)+1.9d0*(-e1(j)+e2(j))/sqrt(2.0d0)
591 dcj=(c(j,i+3)-c(j,i+2))/2.0
592 if (dcj.eq.0) dcj=1.23591524223
597 endif !itype(i+1).eq.ntyp1
598 endif !itype.eq.ntyp1
600 C Calculate the CM of the last side chain.
603 dc(j,ires)=sccor(j,iii)
606 call sccenter(ires,iii,sccor)
610 if (itype(nres).ne.10) then
614 C 2/15/2013 by Adam: corrected insertion of the last dummy residue
615 call refsys(nres-3,nres-2,nres-1,e1,e2,e3,fail)
622 c(j,nres)=c(j,nres-1)+1.9d0*(-e1(j)+e2(j))/sqrt(2.0d0)
626 dcj=(c(j,nres-2)-c(j,nres-3))/2.0
627 if (dcj.eq.0) dcj=1.23591524223
628 c(j,nres)=c(j,nres-1)+dcj
629 c(j,2*nres)=c(j,nres)
640 c(j,2*nres)=c(j,nres)
642 if (itype(1).eq.ntyp1) then
646 C 2/15/2013 by Adam: corrected insertion of the first dummy residue
647 call refsys(2,3,4,e1,e2,e3,fail)
654 c(j,1)=c(j,2)+1.9d0*(e1(j)-e2(j))/dsqrt(2.0d0)
658 dcj=(c(j,4)-c(j,3))/2.0
664 C Copy the coordinates to reference coordinates
670 C Calculate internal coordinates.
671 if (out_template_coord) then
673 & "Cartesian coordinates of the reference structure"
674 write (iout,'(a,3(3x,a5),5x,3(3x,a5))')
675 & "Residue ","X(CA)","Y(CA)","Z(CA)","X(SC)","Y(SC)","Z(SC)"
677 write (iout,'(a3,1x,i4,3f8.3,5x,3f8.3)')
678 & restyp(itype(ires)),ires,(c(j,ires),j=1,3),
679 & (c(j,ires+nres),j=1,3)
684 zero=zero.or.itype(ires).eq.0
687 write (iout,'(2a)') "Gaps in PDB coordinates detected;",
688 & " look for ZERO in the control output above."
689 write (iout,'(2a)') "Repair the PDB file using MODELLER",
690 & " or other softwared and resubmit."
694 C Calculate internal coordinates.
695 call int_from_cart(.true.,out_template_coord)
696 call sc_loc_geom(.false.)
704 dc(j,i)=c(j,i+1)-c(j,i)
705 dc_norm(j,i)=dc(j,i)*vbld_inv(i+1)
710 dc(j,i+nres)=c(j,i+nres)-c(j,i)
711 dc_norm(j,i+nres)=dc(j,i+nres)*vbld_inv(i+nres)
713 c write (iout,*) i,(dc(j,i+nres),j=1,3),(dc_norm(j,i+nres),j=1,3),
719 cref(j,i+nres)=c(j,i+nres)
730 c---------------------------------------------------------------------------
731 subroutine int_from_cart(lside,lprn)
734 include 'COMMON.LOCAL'
736 include 'COMMON.CHAIN'
737 include 'COMMON.INTERACT'
738 include 'COMMON.IOUNITS'
740 include 'COMMON.NAMES'
741 character*3 seq,atom,res
743 double precision sccor(3,50)
745 double precision dist,alpha,beta,di
750 & 'Internal coordinates calculated from crystal structure.'
752 write (iout,'(8a)') ' Res ',' dvb',' Theta',
753 & ' Phi',' Dsc_id',' Dsc',' Alpha',
756 write (iout,'(4a)') ' Res ',' dvb',' Theta',
762 c write (iout,*) i,i-1,(c(j,i),j=1,3),(c(j,i-1),j=1,3),dist(i,i-1)
763 if (itype(i-1).ne.ntyp1 .and. itype(i).ne.ntyp1 .and.
764 & (dist(i,i-1).lt.1.0D0 .or. dist(i,i-1).gt.6.0D0)) then
765 write (iout,'(a,i4)') 'Bad Cartesians for residue',i
769 vbld_inv(i)=1.0d0/vbld(i)
770 theta(i+1)=alpha(i-1,i,i+1)
771 if (i.gt.2) phi(i+1)=beta(i-2,i-1,i,i+1)
773 c if (itype(1).eq.ntyp1) then
775 c c(j,1)=c(j,2)+(c(j,3)-c(j,4))
778 c if (itype(nres).eq.ntyp1) then
780 c c(j,nres)=c(j,nres-1)+(c(j,nres-2)-c(j,nres-3))
786 c(j,maxres2)=0.5D0*(c(j,i-1)+c(j,i+1))
791 if (itype(i).ne.10) then
792 vbld_inv(i+nres)=1.0d0/di
794 vbld_inv(i+nres)=0.0d0
797 alph(i)=alpha(nres+i,i,maxres2)
798 omeg(i)=beta(nres+i,i,maxres2,i+1)
801 alph(i)=alpha(nres+i,i,maxres2)
802 omeg(i)=beta(nres+i,i,maxres2,i+1)
805 & write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
806 & rad2deg*theta(i),rad2deg*phi(i),dsc(iti),di,
807 & rad2deg*alph(i),rad2deg*omeg(i)
812 write (iout,'(a3,i4,7f10.3)') restyp(iti),i,dist(i,i-1),
813 & rad2deg*theta(i),rad2deg*phi(i)
818 c---------------------------------------------------------------------------
819 subroutine sccenter(ires,nscat,sccor)
822 include 'COMMON.CHAIN'
823 integer ires,nscat,i,j
824 double precision sccor(3,50),sccmj
828 sccmj=sccmj+sccor(j,i)
830 dc(j,ires)=sccmj/nscat
834 c---------------------------------------------------------------------------
835 subroutine sc_loc_geom(lprn)
836 implicit real*8 (a-h,o-z)
838 include 'COMMON.LOCAL'
840 include 'COMMON.CHAIN'
841 include 'COMMON.INTERACT'
842 include 'COMMON.IOUNITS'
844 include 'COMMON.NAMES'
845 include 'COMMON.CONTROL'
846 include 'COMMON.SETUP'
847 double precision x_prime(3),y_prime(3),z_prime(3)
851 dc_norm(j,i)=vbld_inv(i+1)*(c(j,i+1)-c(j,i))
855 if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then
857 dc_norm(j,i+nres)=vbld_inv(i+nres)*(c(j,i+nres)-c(j,i))
861 dc_norm(j,i+nres)=0.0d0
866 costtab(i+1) =dcos(theta(i+1))
867 sinttab(i+1) =dsqrt(1-costtab(i+1)*costtab(i+1))
868 cost2tab(i+1)=dsqrt(0.5d0*(1.0d0+costtab(i+1)))
869 sint2tab(i+1)=dsqrt(0.5d0*(1.0d0-costtab(i+1)))
870 cosfac2=0.5d0/(1.0d0+costtab(i+1))
871 cosfac=dsqrt(cosfac2)
872 sinfac2=0.5d0/(1.0d0-costtab(i+1))
873 sinfac=dsqrt(sinfac2)
875 if (it.ne.10 .and. itype(i).ne.ntyp1) then
877 C Compute the axes of tghe local cartesian coordinates system; store in
878 c x_prime, y_prime and z_prime
886 x_prime(j) = (dc_norm(j,i) - dc_norm(j,i-1))*cosfac
887 y_prime(j) = (dc_norm(j,i) + dc_norm(j,i-1))*sinfac
889 c write (iout,*) "x_prime",(x_prime(j),j=1,3)
890 c write (iout,*) "y_prime",(y_prime(j),j=1,3)
891 call vecpr(x_prime,y_prime,z_prime)
892 c write (iout,*) "z_prime",(z_prime(j),j=1,3)
894 C Transform the unit vector of the ith side-chain centroid, dC_norm(*,i),
895 C to local coordinate system. Store in xx, yy, zz.
901 xx = xx + x_prime(j)*dc_norm(j,i+nres)
902 yy = yy + y_prime(j)*dc_norm(j,i+nres)
903 zz = zz + z_prime(j)*dc_norm(j,i+nres)
916 write (iout,*) "xxref,yyref,zzref"
919 write (iout,'(a3,i4,3f10.5)') restyp(iti),i,xxref(i),yyref(i),
925 c---------------------------------------------------------------------------
926 subroutine bond_regular
930 include 'COMMON.LOCAL'
931 include 'COMMON.INTERACT'
932 include 'COMMON.CHAIN'
937 vbld(i+1+nres)=dsc(iabs(itype(i+1)))
938 vbld_inv(i+1+nres)=dsc_inv(iabs(itype(i+1)))
939 c print *,vbld(i+1),vbld(i+1+nres)
941 c Adam 2/26/20 Alter virtual bonds for non-blocking end groups of each chain
947 vbld_inv(i1)=vbld_inv(i1)*2
950 vbld(i2+1)=vbld(i2+1)/2
951 vbld_inv(i2+1)=vbld_inv(i2+1)*2