C C $Id: mkgrid.F,v 1.5 1998/07/16 16:40:06 jjv5 Exp arjan $ C C------------------------------------------------------------------------ CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC C C this file contains subroutines for making the grid C for atom-wise and residue-wise subsetting. C C Written by Arjan van der Vaart, July 1997 C C C x ------> C --------------------------------------------------------------- C | 1 + z | 2 + z | 3 + z | ..... | ncell | y C --------------------------------------------------------------- C |ncell+1+z | ncell+2+z | ncell+3+z | .... | ncell+ncell | C | | | | | + z | | C --------------------------------------------------------------- | C | . | | C | . | v C | . | C | . | C --------------------------------------------------------------- C | (ncell-1)* | (ncell-1)* | (ncell-1)* | ...... | ncell*ncell | C | ncell+1+z | ncell+2+z | ncell+3+z | | + z | C --------------------------------------------------------------- C C C with z=0 for the first layer (starting from cartesian z = 0), C . z=ncell*ncell for the second layer C . ... C . z=(ncell-1)*ncell*ncell for the last layer (maximum cartesian C . z value) C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC CC--------------------------------------------------------------------------CC subroutine mkrgrid C set up the grid for residue-based subsetting implicit double precision(a-h,o-z) #include "divcon.dim" #include "divcon.h" dimension itmp(maxres) C itmp etc refers to the core subsetting (residue based) do 10 i=1,ncell3 itmpadr(i) = 0 10 continue C here itmp(i) = cell index number of residue i C . itmpadr(i) = number of residues in cell i C subsetting is residue based do 20 ires=1,nres ix = (gc(1,ires)-gxyzmin(1))/rcell(1) iy = (gc(2,ires)-gxyzmin(2))/rcell(2) iz = (gc(3,ires)-gxyzmin(3))/rcell(3) indexi = ix + 1 + iy*ncell(1) + iz*ncell2 itmp(ires) = indexi itmpadr(indexi) = itmpadr(indexi) + 1 20 continue C here igridradr(i) = the starting cell in igridr for cell i igridradr(1) = 1 do 30 i=2,ncell3 igridradr(i) = igridradr(i-1)+itmpadr(i-1) itmpadr(i-1) = 0 30 continue itmpadr(ncell3) = 0 C here itmpadr(i) = the number of residues placed in cell i C igridr(i), i=igridradr(n)..igridradr(n)-1 = index of residue in cell n do 40 i=1,nres it = itmp(i) ii = igridradr(it) + itmpadr(it) igridr(ii) = i itmpadr(it) = itmpadr(it) + 1 40 continue igridradr(ncell3+1) = nres+1 end CC------------------------------------------------------------------CC CC------------------------------------------------------------------CC subroutine mkagrid C set up the grid for atom-based subsetting implicit double precision(a-h,o-z) #include "divcon.dim" #include "divcon.h" dimension itmp(maxatm) C itmp etc refers to the buffer subsetting (atom based) do 10 i=1,ncell3 itmpadr(i) = 0 10 continue C here itmp(i) = cell index number of atom i C . itmpadr(i) = number of atoms in cell i C subsetting is atom based do 20 iat=1,natoms ix = (xyz(1,iat)-gxyzmin(1))/rcell(1) iy = (xyz(2,iat)-gxyzmin(2))/rcell(2) iz = (xyz(3,iat)-gxyzmin(3))/rcell(3) indexi = ix + 1 + iy*ncell(1) + iz*ncell2 itmp(iat) = indexi itmpadr(indexi) = itmpadr(indexi) + 1 20 continue C here igridadr(i) = the starting cell in igrid for cell i igridadr(1) = 1 do 30 i=2,ncell3 igridadr(i) = igridadr(i-1)+itmpadr(i-1) itmpadr(i-1) = 0 30 continue itmpadr(ncell3) = 0 C here itmpadr(i) = the number of atoms placed in cell i C igrid(i), i=igridadr(n)..igridadr(n)-1 = index of atom in cell n do 40 i=1,natoms it = itmp(i) ii = igridadr(it) + itmpadr(it) igrid(ii) = i itmpadr(it) = itmpadr(it) + 1 40 continue igridadr(ncell3+1) = natoms+1 end CC-------------------------------------------------------------------CC