[e40e335] | 1 | c **************************************************************
|
---|
| 2 | c
|
---|
| 3 | c This file contains the subroutines: mklist,quench
|
---|
| 4 | c
|
---|
| 5 | c Copyright 2003-2005 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
| 6 | c Shura Hayryan, Chin-Ku
|
---|
| 7 | c Copyright 2007 Frank Eisenmenger, U.H.E. Hansmann,
|
---|
| 8 | c Jan H. Meinke, Sandipan Mohanty
|
---|
| 9 | c
|
---|
| 10 | c **************************************************************
|
---|
| 11 |
|
---|
| 12 | subroutine mklist(nml)
|
---|
| 13 |
|
---|
| 14 | c ......................................................................
|
---|
| 15 | c PURPOSE: Compile interaction lists ('1-4' according to Scheraga)
|
---|
| 16 | c
|
---|
| 17 | c CALLS: quench
|
---|
| 18 | c ......................................................................
|
---|
| 19 | c TODO: Calculate van-der-Waals regions over all molecules.
|
---|
| 20 | include 'INCL.H'
|
---|
| 21 |
|
---|
| 22 | parameter (mxh=50, ! max. # of atom regions
|
---|
| 23 | # mx2=50)
|
---|
| 24 |
|
---|
| 25 | logical ovlp,quench
|
---|
| 26 |
|
---|
| 27 | dimension l1st1(mxh),l1st2(mxh),l2nd1(mxh),l2nd2(mxh)
|
---|
| 28 | # ,l1i(mxbd),l2i(mx2)
|
---|
| 29 |
|
---|
| 30 | c _______________________ indices of 1st vdw-region/14-partner for 'nml'
|
---|
| 31 | if (nml.eq.1) then
|
---|
| 32 | ivwml1(1)=1
|
---|
| 33 | i14ml1(1)=1
|
---|
| 34 | else
|
---|
| 35 | ivwml1(nml)=ivwml1(nml-1)+nvwml(nml-1)
|
---|
| 36 | i14ml1(nml)=i14ml1(nml-1)+n14ml(nml-1)
|
---|
| 37 | endif
|
---|
| 38 |
|
---|
| 39 | ntlms=nmsml(nml)
|
---|
| 40 | if (ntlms.eq.0) then
|
---|
| 41 | write (*,'(a,i4)')
|
---|
| 42 | # ' mklist> No mov. sets defined in molecule #',nml
|
---|
| 43 | nvwml(nml)=0
|
---|
| 44 | n14ml(nml)=0
|
---|
| 45 | return
|
---|
| 46 | endif
|
---|
| 47 |
|
---|
| 48 | nvw=ivwml1(nml)-1 ! # of vdw-regions we have so far
|
---|
| 49 | n14=i14ml1(nml)-1 ! # of 14-partners -"-
|
---|
| 50 | c First atom in molecule
|
---|
| 51 | ifiat=iatrs1(irsml1(nml))
|
---|
| 52 | c Last atom in molecule
|
---|
| 53 | ilaat=iatrs2(irsml2(nml))
|
---|
| 54 | c First variable in molecule
|
---|
| 55 | ifivr=ivrml1(nml)
|
---|
| 56 | c Last variable in molecule
|
---|
| 57 | ilavr=ifivr+nvrml(nml)-1
|
---|
| 58 | c ____________________________ initialize: 1st vdw-region & 14-partner per atom
|
---|
| 59 | do i=ifiat,ilaat
|
---|
| 60 | ivwat1(i)=0 !!! for some atoms ...
|
---|
| 61 | i14at1(i)=0 !!! ... remains = 0
|
---|
| 62 | enddo
|
---|
| 63 | n1st=1 ! initialize 1ST list of interact. partners:
|
---|
| 64 | l1st1(1)=ifiat ! one region including ALL atoms
|
---|
| 65 | l1st2(1)=ilaat ! of molecule 'nml'
|
---|
| 66 |
|
---|
| 67 | i1s=imsml1(nml)+ntlms ! 1st mov.set of molecule 'nml+1'
|
---|
| 68 |
|
---|
| 69 | do io=ilavr,ifivr,-1 ! ====== from last -> first variable in 'nml'
|
---|
| 70 | iv=iorvr(io) ! ====== according to 'descendent' order
|
---|
| 71 | it=ityvr(iv) ! type of var.
|
---|
| 72 | i2s=i1s-1
|
---|
| 73 | i1s=imsvr1(iv)
|
---|
| 74 | if ((i2s-i1s+1).gt.0) then
|
---|
| 75 |
|
---|
| 76 | c ____________ exclude mov.sets of var. 'iv' from 1ST list of interact.partn.
|
---|
| 77 | do is=i1s,i2s
|
---|
| 78 | ovlp=quench(latms1(is),latms2(is),n1st,mxh,l1st1,l1st2)
|
---|
| 79 | enddo
|
---|
| 80 | c _______________________________ intitialize 2ND list with current 1ST list
|
---|
| 81 | do i=1,n1st
|
---|
| 82 | l2nd1(i)=l1st1(i)
|
---|
| 83 | l2nd2(i)=l1st2(i)
|
---|
| 84 | enddo
|
---|
| 85 | n2nd=n1st
|
---|
| 86 | c _________________________________ exclude 'ib' of var. 'iv' from 2ND list
|
---|
| 87 | ib=iowat(iatvr(iv))
|
---|
| 88 | ovlp=quench(ib,ib,n2nd,mxh,l2nd1,l2nd2)
|
---|
| 89 |
|
---|
| 90 | ovlp=.false.
|
---|
| 91 | iob=iowat(ib)
|
---|
| 92 | n2i=0
|
---|
| 93 | if (iob.gt.0) then ! 'iob' exists
|
---|
| 94 | ovlp=quench(iob,iob,n2nd,mxh,l2nd1,l2nd2) ! & in 2ND list
|
---|
| 95 |
|
---|
| 96 | c _____ atoms branching from 'iob': into GENERAL list of 1-4 partners
|
---|
| 97 | do i=1,nbdat(iob)
|
---|
| 98 | ibd=ibdat(i,iob)
|
---|
| 99 | if (ibd.ne.ib.and.iowat(ibd).eq.iob.and.
|
---|
| 100 | # quench(ibd,ibd,n2nd,mxh,l2nd1,l2nd2) ) then
|
---|
| 101 | n2i=n2i+1
|
---|
| 102 | if (n2i.gt.mx2) then
|
---|
| 103 | write (*,'(a,i3,2a)') ' mklist> Molecule # ',nml,
|
---|
| 104 | # ': too many atoms bound to ',nmat(iob)
|
---|
| 105 | stop
|
---|
| 106 | endif
|
---|
| 107 | l2i(n2i)=ibd
|
---|
| 108 | endif
|
---|
| 109 | enddo ! ... branches of 'iob'
|
---|
| 110 | c ____________________________ check for further '1-4' partners
|
---|
| 111 | c connected to branches 'l2i'
|
---|
| 112 | do i=1,n2i
|
---|
| 113 | ia=l2i(i)
|
---|
| 114 | im=ixmsat(ia)
|
---|
| 115 | if (im.gt.0) then
|
---|
| 116 | do j=latms1(im),latms2(im)
|
---|
| 117 | if (ia.ne.j.and.
|
---|
| 118 | # quench(j,j,n2nd,mxh,l2nd1,l2nd2) ) then
|
---|
| 119 | n2i=n2i+1
|
---|
| 120 | if (n2i.gt.mx2) then
|
---|
| 121 | write (*,'(a,i3,a)') ' mklist> Molecule # '
|
---|
| 122 | # ,nml,': too many atoms in list L2I'
|
---|
| 123 | stop
|
---|
| 124 | endif
|
---|
| 125 | l2i(n2i)=j
|
---|
| 126 | endif
|
---|
| 127 | enddo
|
---|
| 128 | endif
|
---|
| 129 | enddo
|
---|
| 130 |
|
---|
| 131 | c ____ If 'iow(iob)' exists and in 2ND list: into GENERAL list of 1-4 partners
|
---|
| 132 | ioiob=iowat(iob) ! existence of iow( iow(base) )
|
---|
| 133 | if (ioiob.gt.0) then
|
---|
| 134 | if( quench(ioiob,ioiob,n2nd,mxh,l2nd1,l2nd2) ) then
|
---|
| 135 | n2i=n2i+1
|
---|
| 136 | if (n2i.gt.mx2) then
|
---|
| 137 | write (*,'(a,i3,2a)') ' mklist> Molecule # '
|
---|
| 138 | # ,nml,': too many atoms bound to ',nmat(iob)
|
---|
| 139 | stop
|
---|
| 140 | endif
|
---|
| 141 | l2i(n2i)=ioiob
|
---|
| 142 | endif
|
---|
| 143 | else
|
---|
| 144 | ioiob=-10
|
---|
| 145 | endif
|
---|
| 146 |
|
---|
| 147 | else
|
---|
| 148 | iob=-10
|
---|
| 149 | ioiob=-10
|
---|
| 150 | endif
|
---|
| 151 |
|
---|
| 152 | c ______ Atoms bound to 'ib' & in 2ND list(=are NOT in m.s of 'iv'):
|
---|
| 153 | c exclude from 2ND list & put in list 'l1i'
|
---|
| 154 | n1i=0
|
---|
| 155 | do i=1,nbdat(ib)
|
---|
| 156 | ibd=ibdat(i,ib)
|
---|
| 157 | if (iowat(ibd).eq.ib.and.
|
---|
| 158 | # quench(ibd,ibd,n2nd,mxh,l2nd1,l2nd2) ) then
|
---|
| 159 | n1i=n1i+1
|
---|
| 160 | if (n1i.gt.mxbd) then
|
---|
| 161 | write (*,'(a,i3,2a)') ' mklist> Molecule # ',nml,
|
---|
| 162 | # ': too many atoms bound to ',nmat(ib)
|
---|
| 163 | stop
|
---|
| 164 | endif
|
---|
| 165 | l1i(n1i)=ibd
|
---|
| 166 | c _______ add atoms branching from 'l1i'-atoms to GENERAL list 1-4 partners
|
---|
| 167 | do j=1,nbdat(ibd)
|
---|
| 168 | jbd=ibdat(j,ibd)
|
---|
| 169 | if (iowat(jbd).eq.ibd.and.
|
---|
| 170 | # quench(jbd,jbd,n2nd,mxh,l2nd1,l2nd2) ) then
|
---|
| 171 | n2i=n2i+1
|
---|
| 172 | if (n2i.gt.mx2) then
|
---|
| 173 | write (*,'(a,i3,2a)') ' mklist> Molecule # ',nml,
|
---|
| 174 | # ': too many atoms bound to branches of ',nmat(ib)
|
---|
| 175 | stop
|
---|
| 176 | endif
|
---|
| 177 | l2i(n2i)=jbd
|
---|
| 178 | endif
|
---|
| 179 | enddo
|
---|
| 180 | endif
|
---|
| 181 | enddo
|
---|
| 182 | c _____________________________ check for further '1-4' partners
|
---|
| 183 | c belonging to moving set of base 'ib'
|
---|
| 184 | im=ixmsat(ib)
|
---|
| 185 | if (im.gt.0) then
|
---|
| 186 | do i=latms1(im),latms2(im)
|
---|
| 187 | if (quench(i,i,n2nd,mxh,l2nd1,l2nd2) ) then
|
---|
| 188 | n2i=n2i+1
|
---|
| 189 | if (n2i.gt.mx2) then
|
---|
| 190 | write (*,'(a,i3,a)') ' mklist> Molecule # ',nml,
|
---|
| 191 | # ': too many atoms n list L2I '
|
---|
| 192 | stop
|
---|
| 193 | endif
|
---|
| 194 | l2i(n2i)=i
|
---|
| 195 | endif
|
---|
| 196 | enddo
|
---|
| 197 | endif
|
---|
| 198 |
|
---|
| 199 | do is=i1s,i2s
|
---|
| 200 | do i=latms1(is),latms2(is) ! ============= atoms in m.s of 'iv'
|
---|
| 201 | c ________________________________________ Current 2ND list -> VdW-interact.
|
---|
| 202 | if ((nvw+n2nd).gt.mxvw) then
|
---|
| 203 | write (*,'(a,i4,a,i5)') ' mklist> Molecule # ',nml,
|
---|
| 204 | # ': Number of vdw-domains > ',mxvw
|
---|
| 205 | stop
|
---|
| 206 | endif
|
---|
| 207 | ivwat1(i)=nvw+1 ! first and last vdW-domain ..
|
---|
| 208 | ivwat2(i)=nvw+n2nd ! .. per atom
|
---|
| 209 | do j=1,n2nd
|
---|
| 210 | nvw=nvw+1
|
---|
| 211 | ixatvw(nvw)=i
|
---|
| 212 | lvwat1(nvw)=l2nd1(j)
|
---|
| 213 | lvwat2(nvw)=l2nd2(j)
|
---|
| 214 | enddo ! ... vdW-domains
|
---|
| 215 | c _________________________________________ General list of 1-4 partners
|
---|
| 216 | if ((n14+n2i).gt.mx14) goto 1
|
---|
| 217 | i14at1(i)=n14+1
|
---|
| 218 | do j=1,n2i
|
---|
| 219 | n14=n14+1
|
---|
| 220 | ixat14(n14)=i
|
---|
| 221 | l14at(n14)=l2i(j)
|
---|
| 222 | enddo
|
---|
| 223 | c __________________________________ Special cases of 1-4 interactions
|
---|
| 224 | c (list l1i, atoms iob,ib)
|
---|
| 225 | iow=iowat(i)
|
---|
| 226 | if (iow.ne.ib) then
|
---|
| 227 | if ((n14+n1i).gt.mx14) goto 1
|
---|
| 228 | do j=1,n1i ! _____ branches of 'ib' NOT in m.s
|
---|
| 229 | n14=n14+1
|
---|
| 230 | ixat14(n14)=i
|
---|
| 231 | l14at(n14)=l1i(j)
|
---|
| 232 | enddo
|
---|
| 233 | if (ovlp.and.(it.eq.1.or.it.eq.2)) then ! _____ iob:
|
---|
| 234 | n14=n14+1 ! b.lengths/angles
|
---|
| 235 | if (n14.gt.mx14) goto 1
|
---|
| 236 | ixat14(n14)=i
|
---|
| 237 | l14at(n14)=iob
|
---|
| 238 | endif
|
---|
| 239 | if (iowat(iow).ne.ib.and.it.eq.1) then ! ___ ib:
|
---|
| 240 | n14=n14+1 ! b.length
|
---|
| 241 | if (n14.gt.mx14) goto 1
|
---|
| 242 | ixat14(n14)=i
|
---|
| 243 | l14at(n14)=ib
|
---|
| 244 | endif
|
---|
| 245 | endif ! ... spec. case
|
---|
| 246 | i14at2(i)=n14
|
---|
| 247 | enddo ! ... atoms for moving set 'is'
|
---|
| 248 | enddo ! ... m.s for var. 'iv'
|
---|
| 249 |
|
---|
| 250 | endif ! if there are moving sets
|
---|
| 251 | enddo ! ... variables
|
---|
| 252 |
|
---|
| 253 | nvwml(nml)=nvw-ivwml1(nml)+1
|
---|
| 254 | n14ml(nml)=n14-i14ml1(nml)+1
|
---|
| 255 | c _________________________________ some cleaning up
|
---|
| 256 | do i=ifiat,ilaat
|
---|
| 257 | if (ivwat1(i).le.0) then
|
---|
| 258 | ivwat1(i)=1
|
---|
| 259 | ivwat2(i)=0
|
---|
| 260 | endif
|
---|
| 261 | if (i14at1(i).le.0) then
|
---|
| 262 | i14at1(i)=1
|
---|
| 263 | i14at2(i)=0
|
---|
| 264 | endif
|
---|
| 265 | enddo
|
---|
| 266 |
|
---|
| 267 | c ____________________________________________ Summary
|
---|
| 268 | c do i=ifiat,ilaat
|
---|
| 269 | c write (*,'(3a,i5,a)') ' ######## atom ',nmat(i),'(',i,')'
|
---|
| 270 | c iv1=ivwat1(i)
|
---|
| 271 | c iv2=ivwat2(i)
|
---|
| 272 | c if (iv1.le.iv2) then
|
---|
| 273 | c write(*,'(a)') ' ---> vdW :'
|
---|
| 274 | c do j=iv1,iv2
|
---|
| 275 | c write (*,'(i5,a,i5)') lvwat1(j),'-',lvwat2(j)
|
---|
| 276 | c enddo
|
---|
| 277 | c endif
|
---|
| 278 | c i41=i14at1(i)
|
---|
| 279 | c i42=i14at2(i)
|
---|
| 280 | c if (i41.le.i42) then
|
---|
| 281 | c write(*,'(a)') ' ---> 1-4 :'
|
---|
| 282 | c write(*,'(10i5)') (l14at(j),j=i41,i42)
|
---|
| 283 | c endif
|
---|
| 284 | c enddo
|
---|
| 285 |
|
---|
| 286 | return
|
---|
| 287 |
|
---|
| 288 | 1 write (*,'(a,i4,a,i5)') ' mklist> Molecule # ',nml,
|
---|
| 289 | # ': Number of 1-4 interactions > ',mx14
|
---|
| 290 | stop
|
---|
| 291 | end
|
---|
| 292 | c *********************************************
|
---|
| 293 | logical function quench(i1,i2,n,mx,l1,l2)
|
---|
| 294 |
|
---|
| 295 | c ....................................................
|
---|
| 296 | c PURPOSE: Correct size/number (n) of index ranges
|
---|
| 297 | c given by lists 'l1' & 'l2' in order to
|
---|
| 298 | c EXCLUDE overlaps with range 'i1-i2'
|
---|
| 299 | c
|
---|
| 300 | c quench = true, if any overlap was obtained
|
---|
| 301 | c
|
---|
| 302 | c CALLS: none
|
---|
| 303 | c
|
---|
| 304 | c ....................................................
|
---|
| 305 |
|
---|
| 306 | implicit integer*4 (i-n)
|
---|
| 307 |
|
---|
| 308 | dimension l1(mx),l2(mx)
|
---|
| 309 |
|
---|
| 310 | quench=.false. ! initialize
|
---|
| 311 |
|
---|
| 312 | j=1
|
---|
| 313 | do while (j.le.n) ! while there are sets
|
---|
| 314 | j1=l1(j)
|
---|
| 315 | j2=l2(j)
|
---|
| 316 |
|
---|
| 317 | if (i1.le.j2.and.i2.ge.j1) then ! Overlap
|
---|
| 318 | quench=.true.
|
---|
| 319 |
|
---|
| 320 | ja=0
|
---|
| 321 | if (i1.gt.j1) then
|
---|
| 322 | ja=1
|
---|
| 323 | l2(j)=i1-1
|
---|
| 324 | endif
|
---|
| 325 | if (i2.lt.j2) then
|
---|
| 326 | if (ja.gt.0) then ! +1 set
|
---|
| 327 | n=n+1
|
---|
| 328 | if (n.gt.mx) then
|
---|
| 329 | write (*,'(a)') ' quench> too many sets'
|
---|
| 330 | stop
|
---|
| 331 | endif
|
---|
| 332 | do k=n,j+2,-1 ! shift sets
|
---|
| 333 | l1(k)=l1(k-1)
|
---|
| 334 | l2(k)=l2(k-1)
|
---|
| 335 | enddo
|
---|
| 336 | l2(j+1)=j2
|
---|
| 337 | endif
|
---|
| 338 | l1(j+ja)=i2+1
|
---|
| 339 | ja=ja+1
|
---|
| 340 | endif
|
---|
| 341 |
|
---|
| 342 | if (ja.eq.0) then ! -1 set
|
---|
| 343 | n=n-1
|
---|
| 344 | do k=j,n
|
---|
| 345 | l1(k)=l1(k+1)
|
---|
| 346 | l2(k)=l2(k+1)
|
---|
| 347 | enddo
|
---|
| 348 | else
|
---|
| 349 | j=j+ja
|
---|
| 350 | endif
|
---|
| 351 |
|
---|
| 352 | else ! No overlap
|
---|
| 353 | j=j+1
|
---|
| 354 | endif
|
---|
| 355 |
|
---|
| 356 | enddo ! ... sets
|
---|
| 357 |
|
---|
| 358 | return
|
---|
| 359 | end
|
---|
| 360 |
|
---|