subroutine pdbstatread(*) include "DIMENSIONS" include "DIMENSIONS.ZSCOPT" #ifdef MPI include 'mpif.h' include 'COMMON.MPI' include 'COMMON.MPISET' integer ierror double precision bufin(maxpoint),bufout(maxpoint) integer ibufin(maxpoint),ibufout(maxpoint) double precision sumweight_pdb_(0:ntyp,0:ntyp) #endif include "COMMON.PDBSTAT" include "COMMON.IOUNITS" include "COMMON.WEIGHTS" include "COMMON.TORSION" include "COMMON.GEO" double precision sumweight_pdb(0:ntyp,0:ntyp) integer rescode logical lprn /.false./ write (iout,*) "Calling PDBSTATREAD" write (iout,*) "deg2rad",deg2rad #ifdef MPI write (iout,*) "Master",Master if (me.eq.Master) then #endif do i=0,ntortyp-1 do j=0,ntortyp-1 npdbtor(i,j)=0 sumweight_pdb(i,j)=0.0d0 enddo enddo ii=0 do i=1,maxpoint read (icsa_seed,'(4f10.5,4i5,3x,a3,1x,a3)',end=13,err=13) & zz_pdb(1,ii+1),zz_pdb(2,ii+1),zz_pdb(3,ii+1),resol(ii+1), & ires1,ires2,iat1,iat2,res1,res2 if (zz_pdb(1,ii+1).gt.deg2rad*70.and. & zz_pdb(2,ii+1).gt.deg2rad*70) then ii=ii+1 i1=itype2loc(rescode(1,res1,0)) i2=itype2loc(rescode(1,res2,0)) ipdbtyp(1,ii)=i1 ipdbtyp(2,ii)=i2 npdbtor(i1,i2)=npdbtor(i1,i2)+1 sumweight_pdb(i1,i2)=sumweight_pdb(i1,i2)+1.0d0/resol(ii)**2 if (lprn) write(iout,'(i7,3f10.5,2i5,f10.5)') & ii,zz_pdb(1,ii),zz_pdb(2,ii),zz_pdb(3,ii), & ipdbtyp(1,ii),ipdbtyp(2,ii),resol(ii) endif enddo 13 npoint_pdb=ii write (iout,*)npoint_pdb," data points found in file" write(iout,*) & "Numbers of points for the pairs of types and sumweight" do i=0,ntortyp-1 do j=0,ntortyp-1 write (2,*) i,j,npdbtor(i,j),sumweight_pdb(i,j) enddo enddo do i=1,npoint_pdb i1 = ipdbtyp(1,i) i2 = ipdbtyp(2,i) resol(i)=resol(i)/sumweight_pdb(i1,i2) enddo c Check normalization of the resol array sumweight_pdb=0.0d0 do i=1,npoint_pdb i1 = ipdbtyp(1,i) i2 = ipdbtyp(2,i) sumweight_pdb(i1,i2)=sumweight_pdb(i1,i2)+resol(i) enddo write (iout,*) "The sumweight_pdb array after normalization" do i1=0,ntortyp-1 do i2=0,ntortyp-1 write (2,*) i1,i2,sumweight_pdb(i1,i2) if (dabs(sumweight_pdb(i1,i2)-1.0d0).gt.1.0d-7) then write (iout,*) "!!!! CHECKSUM ERROR IN sumweight_pdb", & i1,i2,sumweight_pdb(i1,i2) call MPI_Abort(MPI_COMM_WORLD,ierror) stop endif enddo enddo #ifdef MPI npoint_pdb_all=npoint_pdb call work_partition_pmf(npoint_pdb_all,.true.) write (iout,*) "After scatter" write (iout,*) "scount_pmf",(scount_pmf(i),i=0,nprocs-1) call flush(iout) endif call MPI_Bcast(npdbtor(1,1),1,MPI_INTEGER,Master,WHAM_COMM,ierror) call MPI_Scatter(scount_pmf,1,MPI_INTEGER,npoint_pdb,1, & MPI_INTEGER,Master,WHAM_COMM,ierror) write (iout,*) "After scatter scount npoint_pdb",npoint_pdb call flush(iout) c Distribute angles do j=1,3 if (me.eq.Master) then do i=1,npoint_pdb_all bufin(i)=zz_pdb(j,i) enddo endif call MPI_Scatterv(bufin(1),scount_pmf,idispl_pmf, & MPI_DOUBLE_PRECISION, & bufout(1),npoint_pdb,MPI_DOUBLE_PRECISION,Master, & WHAM_COMM,ierror) do i=1,npoint_pdb zz_pdb(j,i)=bufout(i) enddo enddo write (iout,*) "ZZ_pdb distributed" call flush(iout) C Distribute angle types do j=1,2 if (me.eq.Master) then do i=1,npoint_pdb_all ibufin(i)=ipdbtyp(j,i) enddo endif call MPI_Scatterv(ibufin(1),scount_pmf,idispl_pmf, & MPI_INTEGER, & ibufout(1),npoint_pdb,MPI_INTEGER,Master, & WHAM_COMM,ierror) do i=1,npoint_pdb ipdbtyp(j,i)=ibufout(i) enddo enddo write (iout,*) "ipdbtyp distributed" call flush(iout) c Distribute resolutions if (me.eq.Master) then do i=1,npoint_pdb_all bufin(i)=resol(i) enddo endif call MPI_Scatterv(bufin(1),scount_pmf,idispl_pmf, & MPI_DOUBLE_PRECISION, & resol(1),npoint_pdb,MPI_DOUBLE_PRECISION,Master, & WHAM_COMM,ierror) c Check normalization of the resol array sumweight_pdb_=0.0d0 do i=1,npoint_pdb i1 = ipdbtyp(1,i) i2 = ipdbtyp(2,i) sumweight_pdb_(i1,i2)=sumweight_pdb_(i1,i2)+resol(i) enddo write (iout,*) "Before REDUCE" call MPI_Reduce(sumweight_pdb_,sumweight_pdb,(ntyp+1)*(ntortyp+1), & MPI_DOUBLE_PRECISION,MPI_SUM,Master,Comm1,ierror) write (iout,*) "After REDUCE" if (me.eq.Master) then write (iout,*) & "The distributed sumweight_pdb array after normalization" do i1=0,ntortyp-1 do i2=0,ntortyp-1 write (2,*) i1,i2,sumweight_pdb(i1,i2) if (dabs(sumweight_pdb(i1,i2)-1.0d0).gt.1.0d-7) then write (iout,*) "!!!! CHECKSUM ERROR IN sumweight_pdb", & i1,i2,sumweight_pdb(i1,i2) call MPI_Abort(MPI_COMM_WORLD,ierror) stop endif enddo enddo endif if (lprn) then write (iout,*) "Points asigned to the procesor" do i=1,npoint_pdb write(iout,'(i7,3f10.5,2i5,1pe10.2)') & i,zz_pdb(1,i),zz_pdb(2,i),zz_pdb(3,i), & ipdbtyp(1,i),ipdbtyp(2,i),resol(i) enddo endif n_calka = ((160-70)/incr_theta-1)**2*(360/incr_gam-1) write (iout,*) "n_calka",n_calka call work_partition_pmf(n_calka,.true.) istart_calka=indstart_pmf(me) iend_calka=indend_pmf(me) write (iout,*) "Processor",me," n_calka",n_calka, & " istart_calka",istart_calka," iend_calka",iend_calka call flush(iout) #endif return end