1 subroutine pdbstatread(*)
3 include "DIMENSIONS.ZSCOPT"
7 include 'COMMON.MPISET'
9 double precision bufin(maxpoint),bufout(maxpoint)
10 integer ibufin(maxpoint),ibufout(maxpoint)
11 double precision sumweight_pdb_(0:ntyp,0:ntyp)
13 include "COMMON.PDBSTAT"
14 include "COMMON.IOUNITS"
15 include "COMMON.WEIGHTS"
16 include "COMMON.TORSION"
18 double precision sumweight_pdb(0:ntyp,0:ntyp)
20 logical lprn /.false./
21 write (iout,*) "Calling PDBSTATREAD"
22 write (iout,*) "deg2rad",deg2rad
25 write (iout,*) "Master",Master
26 if (me.eq.Master) then
31 sumweight_pdb(i,j)=0.0d0
36 read (icsa_seed,'(4f10.5,4i5,3x,a3,1x,a3)',end=13,err=13)
37 & zz_pdb(1,ii+1),zz_pdb(2,ii+1),zz_pdb(3,ii+1),resol(ii+1),
38 & ires1,ires2,iat1,iat2,res1,res2
39 if (zz_pdb(1,ii+1).gt.deg2rad*70.and.
40 & zz_pdb(2,ii+1).gt.deg2rad*70) then
42 i1=itype2loc(rescode(1,res1,0))
43 i2=itype2loc(rescode(1,res2,0))
46 npdbtor(i1,i2)=npdbtor(i1,i2)+1
47 sumweight_pdb(i1,i2)=sumweight_pdb(i1,i2)+1.0d0/resol(ii)**2
48 if (lprn) write(iout,'(i7,3f10.5,2i5,f10.5)')
49 & ii,zz_pdb(1,ii),zz_pdb(2,ii),zz_pdb(3,ii),
50 & ipdbtyp(1,ii),ipdbtyp(2,ii),resol(ii)
54 write (iout,*)npoint_pdb," data points found in file"
56 & "Numbers of points for the pairs of types and sumweight"
59 write (2,*) i,j,npdbtor(i,j),sumweight_pdb(i,j)
65 resol(i)=resol(i)/sumweight_pdb(i1,i2)
67 c Check normalization of the resol array
72 sumweight_pdb(i1,i2)=sumweight_pdb(i1,i2)+resol(i)
74 write (iout,*) "The sumweight_pdb array after normalization"
77 write (2,*) i1,i2,sumweight_pdb(i1,i2)
78 if (dabs(sumweight_pdb(i1,i2)-1.0d0).gt.1.0d-7) then
79 write (iout,*) "!!!! CHECKSUM ERROR IN sumweight_pdb",
80 & i1,i2,sumweight_pdb(i1,i2)
81 call MPI_Abort(MPI_COMM_WORLD,ierror)
87 npoint_pdb_all=npoint_pdb
88 call work_partition_pmf(npoint_pdb_all,.true.)
89 write (iout,*) "After scatter"
90 write (iout,*) "scount_pmf",(scount_pmf(i),i=0,nprocs-1)
93 call MPI_Bcast(npdbtor(1,1),1,MPI_INTEGER,Master,WHAM_COMM,ierror)
94 call MPI_Scatter(scount_pmf,1,MPI_INTEGER,npoint_pdb,1,
95 & MPI_INTEGER,Master,WHAM_COMM,ierror)
96 write (iout,*) "After scatter scount npoint_pdb",npoint_pdb
100 if (me.eq.Master) then
101 do i=1,npoint_pdb_all
105 call MPI_Scatterv(bufin(1),scount_pmf,idispl_pmf,
106 & MPI_DOUBLE_PRECISION,
107 & bufout(1),npoint_pdb,MPI_DOUBLE_PRECISION,Master,
110 zz_pdb(j,i)=bufout(i)
113 write (iout,*) "ZZ_pdb distributed"
115 C Distribute angle types
117 if (me.eq.Master) then
118 do i=1,npoint_pdb_all
119 ibufin(i)=ipdbtyp(j,i)
122 call MPI_Scatterv(ibufin(1),scount_pmf,idispl_pmf,
124 & ibufout(1),npoint_pdb,MPI_INTEGER,Master,
127 ipdbtyp(j,i)=ibufout(i)
130 write (iout,*) "ipdbtyp distributed"
132 c Distribute resolutions
133 if (me.eq.Master) then
134 do i=1,npoint_pdb_all
138 call MPI_Scatterv(bufin(1),scount_pmf,idispl_pmf,
139 & MPI_DOUBLE_PRECISION,
140 & resol(1),npoint_pdb,MPI_DOUBLE_PRECISION,Master,
142 c Check normalization of the resol array
147 sumweight_pdb_(i1,i2)=sumweight_pdb_(i1,i2)+resol(i)
149 write (iout,*) "Before REDUCE"
150 call MPI_Reduce(sumweight_pdb_,sumweight_pdb,(ntyp+1)*(ntortyp+1),
151 & MPI_DOUBLE_PRECISION,MPI_SUM,Master,Comm1,ierror)
152 write (iout,*) "After REDUCE"
154 if (me.eq.Master) then
157 & "The distributed sumweight_pdb array after normalization"
160 write (2,*) i1,i2,sumweight_pdb(i1,i2)
161 if (dabs(sumweight_pdb(i1,i2)-1.0d0).gt.1.0d-7) then
162 write (iout,*) "!!!! CHECKSUM ERROR IN sumweight_pdb",
163 & i1,i2,sumweight_pdb(i1,i2)
164 call MPI_Abort(MPI_COMM_WORLD,ierror)
173 write (iout,*) "Points asigned to the procesor"
175 write(iout,'(i7,3f10.5,2i5,1pe10.2)')
176 & i,zz_pdb(1,i),zz_pdb(2,i),zz_pdb(3,i),
177 & ipdbtyp(1,i),ipdbtyp(2,i),resol(i)
180 n_calka = ((160-70)/incr_theta-1)**2*(360/incr_gam-1)
181 write (iout,*) "n_calka",n_calka
182 call work_partition_pmf(n_calka,.true.)
183 istart_calka=indstart_pmf(me)
184 iend_calka=indend_pmf(me)
185 write (iout,*) "Processor",me," n_calka",n_calka,
186 & " istart_calka",istart_calka," iend_calka",iend_calka