You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The centering of grids appears to depend on the dimension argument- the output grids are only centered at the provided center if dimension is divisible by resolution. See the following example:
import molgrid, torch
# single atom with radius=1.0 located at (0,0,0)
coords = torch.zeros((1, 3), device='cuda')
types = torch.ones((1, 1), device='cuda')
radii = torch.ones((1,), device='cuda')
# two grid makers with resolution=1.0 and center=(0,0,0)
# with same size (# points) but different "dimensions"
gridder1 = molgrid.Coords2Grid(
gmaker=molgrid.GridMaker(
resolution=1.0,
dimension=2.0,
),
center=(0,0,0)
)
gridder2 = molgrid.Coords2Grid(
gmaker=molgrid.GridMaker(
resolution=1.0,
dimension=1.9,
),
center=(0,0,0)
)
grid1 = gridder1.forward(coords, types, radii)
grid2 = gridder2.forward(coords, types, radii)
print('grids have the same shape:', grid1.shape == grid2.shape)
print('grids have the same values:', (grid1 == grid2).all().item())
m = tuple(dim//2 for dim in grid1.shape) # midpoint index
print('grid1 is centered at (0,0,0):', (grid1[m] == 1.0).item())
print('grid2 is centered at (0,0,0):', (grid2[m] == 1.0).item())
def check_symmetry(grid):
return (
(grid == grid.flip(dims=(1,))).all() and
(grid == grid.flip(dims=(2,))).all() and
(grid == grid.flip(dims=(3,))).all()
).item()
print('grid1 is symmetric:', check_symmetry(grid1))
print('grid2 is symmetric:', check_symmetry(grid2))
Which produces this output:
grids have the same shape: True
grids have the same values: False
grid1 is centered at (0,0,0): True
grid2 is centered at (0,0,0): False
grid1 is symmetric: True
grid2 is symmetric: False
The text was updated successfully, but these errors were encountered:
The centering of grids appears to depend on the
dimension
argument- the output grids are only centered at the providedcenter
ifdimension
is divisible byresolution
. See the following example:Which produces this output:
The text was updated successfully, but these errors were encountered: