Input:
atoms(N) |
▷ XYZ coordinates from PDB file |
mincoor ← minval(atoms) |
▷ Compute dimensions of bounding box |
maxcoor ← maxval(atoms) |
|
R ← boxsize
|
▷ Set size of grid |
Nbox ← ceiling((maxcoor − mincoor)/R) |
▷ Compute number of boxes in each direction |
for
ii ← 1, Natoms
do
|
|
i, j, k ← ceiling((atoms(ii) − mincoor)/R) |
▷ Count the number of atoms in each box |
Natoms(i, j, k) ← Natoms(i, j, k) + 1 |
|
end for |
|
for
k ← 1, Nbox[3] do
|
|
for
j ← 1, Nbox[2] do
|
|
for
i ← 1, Nbox[1] do
|
|
allocate(box(i, j, k)) |
▷ Allocate space for each box |
end for
|
|
end for
|
|
end for |
|
for
ii ← 1, Natoms
do
|
▷ Copy coordinates to appropriate box based on 3D coordinates |
i, j, k ← ceiling((atoms(ii) − mincoor)/R) |
|
box(i, j, k) ← atoms(ii) |
|
end for |
|
for
k ← 1, Nbox[3] do
|
▷ Iterate over boxes |
for
j ← 1, Nbox[2] do
|
|
for
i ← 1, Nbox[1] do
|
|
for
na ← 1, Natoms(i, j, k) do
|
▷ Iterate over atoms in current box |
for
n ← k − 1, k + 1 do
|
▷ Iterate over adjacent boxes |
for
m ← j − 1, j + 1 do
|
|
for
l ← i − 1, i + 1 do
|
|
for
nb ← 1, Natoms(l, m, n) do
|
▷ Iterate over atoms in adjacent boxes |
dist ← distance(box(i, j, k)(na), box(l, m, n)(nb)) |
|
FRI(na) ← kernel(dist) |
|
end for
|
|
end for
|
|
end for
|
|
end for
|
|
end for
|
|
end for
|
|
end for
|
|
end for |
|