double precision function rmsnat(ib,jcon,iref,iprot) implicit none include 'DIMENSIONS' include 'DIMENSIONS.ZSCOPT' include 'COMMON.IOUNITS' include 'COMMON.COMPAR' include 'COMMON.CHAIN' include 'COMMON.INTERACT' include 'COMMON.VAR' double precision creff(3,maxres2),cc(3,maxres2) integer jcon,ib,iref,iprot double precision rmscalc rmsnat=rmscalc(c(1,1),cref(1,1,iref,ib,iprot),jcon,iref,iprot) return end c------------------------------------------------------------------------ double precision function rmscalc(ccc,cccref,jcon,iref,iprot) implicit none include 'DIMENSIONS' include 'DIMENSIONS.ZSCOPT' include 'COMMON.IOUNITS' include 'COMMON.COMPAR' include 'COMMON.CHAIN' include 'COMMON.INTERACT' include 'COMMON.VAR' double precision cccref(3,maxres2),creff(3,maxres2), & ccc(3,maxres2),cc(3,maxres2) double precision przes(3),obrot(3,3) logical non_conv integer ishif,i,ii,j,jcon,ib,iref,iprot double precision rms ii=0 if (.not.sconly(iprot)) then do i=nstart_sup(iprot),nend_sup(iprot) if (itype(i).ne.ntyp1) then ii=ii+1 do j=1,3 cc(j,ii)=ccc(j,i) creff(j,ii)=cccref(j,i) enddo endif enddo endif do i=nstart_sup(iprot),nend_sup(iprot) if (itype(i).ne.10 .and. itype(i).ne.ntyp1) then ii=ii+1 do j=1,3 cc(j,ii)=ccc(j,i+nres) creff(j,ii)=cccref(j,i+nres) enddo endif enddo write (iout,*) "rmscalc: iprot",iprot," nsup",nsup(iprot)," ii",ii call fitsq(rms,cc(1,1),creff(1,1),ii,przes,obrot,non_conv) if (non_conv) then write (iout,*) 'Error: FITSQ non-convergent, iprot',iprot, & ' jcon',jcon,' iref',iref rmscalc=1.0d2 else if (rms.lt.-1.0d-6) then print *,'Error: rms^2 = ',rms,jcon rmscalc = 1.0d2 else if (rms.ge.1.0d-6 .and. rms.lt.0) then rmscalc=0.0d0 else rmscalc = dsqrt(rms) endif return end